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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
su_pyae
Creator
Creator

If condition in the data load script to check whether I should load this data or not

Hi everyone, 

I have a bunch of files (abc_2019, abc_2020) which I have extracted YEAR from those file names. 

If Max(YEAR) < current year, I want to download last year data as QVD file. 

If it's not, we won't do anything. 

 

I have used IF statements after LOAD command but I have not used IF statement outside of LOAD.

I am not even sure whether I can do what I want in Qlik Sense. 

Please let me know if you have tried this before. 

1 Solution

Accepted Solutions
simonaubert
Partner - Specialist II
Partner - Specialist II

hello,

You can use a conditional statement inside or outside a load statement but it won't be written the same way.

Outside a load will be :
IF condition Then
 what happens if true
ELSE
what happens if wrong
END

You can also use a ELSEIF if you have several cases.


What you need is a loop on the file list and inside the loop the if statement.

https://help.qlik.com/en-US/sense/June2020/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptControlS...
https://help.qlik.com/en-US/sense/June2020/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptControlS...

 

Best regards,

Simon

Bi Consultant (Dataviz & Dataprep) @ Business & Decision

View solution in original post

1 Reply
simonaubert
Partner - Specialist II
Partner - Specialist II

hello,

You can use a conditional statement inside or outside a load statement but it won't be written the same way.

Outside a load will be :
IF condition Then
 what happens if true
ELSE
what happens if wrong
END

You can also use a ELSEIF if you have several cases.


What you need is a loop on the file list and inside the loop the if statement.

https://help.qlik.com/en-US/sense/June2020/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptControlS...
https://help.qlik.com/en-US/sense/June2020/Subsystems/Hub/Content/Sense_Hub/Scripting/ScriptControlS...

 

Best regards,

Simon

Bi Consultant (Dataviz & Dataprep) @ Business & Decision