Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi Folks,
Below is my scenario:
I'm calling 'ABC' table again and again as Concatenate based on bold mark condition's (Date.tmp2) < 6 or Date.tmp2) < 5.
ABC:
LOAD
*,
hour(Date.tmp2) as Time.tmp,
IF(hour(Date.tmp2) < 6, Date.tmp2-1,Date.tmp2) as Date.tmp
;
LOAD
num(Date) as Date.tmp2,
timestamp(Date) as Date_Org,
Facility_Id,
----
-----
FROM
[$(vDataPath)ABC.qvd]
(qvd)
Where Match(Facility_Id,'KOF','KISA','KSI','KBL','KKS','KUL','KBO','KCQ','KTX','KMX','KDT','KUS');
Concatenate
LOAD
*,
hour(Date.tmp2) as Time.tmp,
IF(hour(Date.tmp2) < 5, Date.tmp2-1,Date.tmp2) as Date.tmp
;
LOAD
num(Date) as Date.tmp2,
timestamp(Date) as Date_Org,
Facility_Id,
----
-----
FROM
[$(vDataPath)ABC.qvd]
(qvd)
Where Match(Facility_Id,'KUK');
But I'm thinking of loading CAQ table only once by giving one if condition to avoid Concatenate , so I'm trying below , but looks like it's not working:
ABC:
LOAD
*,
hour(Date.tmp2) as Time.tmp,
if(match(Facility_Id,'KOF','KISA','KSI','KBL','KKS','KUL','KBO','KCQ','KTX','KMX','KDT','KUS'),IF(hour(Date.tmp2) < 6, Date.tmp2-1, if(match(Facility_Id,'KUK'),IF(hour(Date.tmp2) < 5, Date.tmp2-1,Date.tmp2) )))as Date.tmp
;
LOAD
num(Date) as Date.tmp2,
timestamp(Date) as Date_Org,
Facility_Id,
----
-----
FROM
[$(vDataPath)ABC.qvd]
(qvd);
Please suggest why???
or any other better solution for this situation ?
Regards,
AS
Perhaps like this:
ABC:
LOAD
*,
hour(Date.tmp2) as Time.tmp,
if(match(Facility_Id,'KOF','KISA','KSI','KBL','KKS','KUL','KBO','KCQ','KTX','KMX','KDT','KUS') AND hour(Date.tmp2) < 6, Date.tmp2-1, if(match(Facility_Id,'KUK') AND hour(Date.tmp2) < 5, Date.tmp2-1,Date.tmp2),Date.tmp2) as Date.tmp
;
LOAD
num(Date) as Date.tmp2,
timestamp(Date) as Date_Org,
Facility_Id,
----
-----
FROM
[$(vDataPath)ABC.qvd]
(qvd);
Perhaps like this:
ABC:
LOAD
*,
hour(Date.tmp2) as Time.tmp,
if(match(Facility_Id,'KOF','KISA','KSI','KBL','KKS','KUL','KBO','KCQ','KTX','KMX','KDT','KUS') AND hour(Date.tmp2) < 6, Date.tmp2-1, if(match(Facility_Id,'KUK') AND hour(Date.tmp2) < 5, Date.tmp2-1,Date.tmp2),Date.tmp2) as Date.tmp
;
LOAD
num(Date) as Date.tmp2,
timestamp(Date) as Date_Org,
Facility_Id,
----
-----
FROM
[$(vDataPath)ABC.qvd]
(qvd);
Thank you!
Regards,
AS