Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Using If while loading

Dear All,

I want to use if clause while loading data/files in script.

My files are having date and want to stop the script to run/reload once date will reach specific date.

i.e. if DATE > 10/01/2013, the script will show me error and nothing will be loaded....

is it possible?

1 Solution

Accepted Solutions
jagannalla
Partner - Specialist III
Partner - Specialist III

what is the format of date column ?

Either timestamp or date ?

If possible try this

Where Date(DATE,'DD/MM/YYYY')) <= Date('10/01/2013','DD/MM/YYYY');

(or)

Where Date(DATE,'DD/MM/YYYY hh:mm:ss')) <= Date('10/01/2013','DD/MM/YYYY hh:mm:ss');

Cheers!!

Jagan

View solution in original post

5 Replies
Gysbert_Wassenaar

Try adding a where clause:

Table1:

LOAD *

[myexcelfile.xls] (biff, embedded labels, table is Sheet1$)

Where Date#(DATE,'DD/MM/YYYY')) <= Date#('10/01/2013','DD/MM/YYYY');

With DATE being the field you want to filter on. This will not throw an error, but just not load anything with a date over 10/01/2013.


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks for your reply.

Tried above but it's not loading data at all... even if my date is less than date 10/01/2013

Not applicable
Author

Thanks for your reply.

Tried above but it's not loading data at all... even if my date is less than date 10/01/2013

jagannalla
Partner - Specialist III
Partner - Specialist III

what is the format of date column ?

Either timestamp or date ?

If possible try this

Where Date(DATE,'DD/MM/YYYY')) <= Date('10/01/2013','DD/MM/YYYY');

(or)

Where Date(DATE,'DD/MM/YYYY hh:mm:ss')) <= Date('10/01/2013','DD/MM/YYYY hh:mm:ss');

Cheers!!

Jagan

Not applicable
Author

Excellent.... working fine.