Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
amit_saini
Master III
Master III

If statement help to avoid Concatenate

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

1 Solution

Accepted Solutions
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

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);


talk is cheap, supply exceeds demand

View solution in original post

2 Replies
Gysbert_Wassenaar
Partner - Champion III
Partner - Champion III

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);


talk is cheap, supply exceeds demand
amit_saini
Master III
Master III
Author

Thank you!

Regards,

AS