Skip to main content
Announcements
Qlik Introduces a New Era of Visualization! READ ALL ABOUT IT
cancel
Showing results for 
Search instead for 
Did you mean: 
jasonrimkus
Contributor II
Contributor II

If Else Qliksense Load Script

Migrating an App to Qliksense, the following script worked as intended in Qlikview, but is throwing syntax errors in QS.  

the variable governs whether or not i  want to load in where CustomerNLCStatusAsOfCall = 'N/L'  or not.  This greatly reduces the data, but sometimes i want to load them in for other analysis.  \

if $(vLoadClients) = 0, Load this Script, Load other script

------------------------------------------------------------------------

if $(vLoadClients) = 0
Activities: NoConcatenate
Load * Resident ActivitiesTEMP
where year(ActivityDate) >= '$(vResultsThruYear)' 
and (CustomerNLCStatusAsOfCall = 'N/L' or CustomerNLCStatusAsOfCall = 'UnMatched')
;
Else
Activities: NoConcatenate
Load * Resident ActivitiesTEMP
where year(ActivityDate) >= '$(vResultsThruYear)'
;
Endif;

Labels (3)
1 Solution

Accepted Solutions
GaryGiles
Specialist
Specialist

In Qlik Sense, you need a "then" with If and space between endif.  Try this:

if $(vLoadClients) = 0 then 
Activities: NoConcatenate
Load * Resident ActivitiesTEMP
where year(ActivityDate) >= '$(vResultsThruYear)' 
and (CustomerNLCStatusAsOfCall = 'N/L' or CustomerNLCStatusAsOfCall = 'UnMatched')
;
Else
Activities: NoConcatenate
Load * Resident ActivitiesTEMP
where year(ActivityDate) >= '$(vResultsThruYear)'
;
End if

View solution in original post

2 Replies
GaryGiles
Specialist
Specialist

In Qlik Sense, you need a "then" with If and space between endif.  Try this:

if $(vLoadClients) = 0 then 
Activities: NoConcatenate
Load * Resident ActivitiesTEMP
where year(ActivityDate) >= '$(vResultsThruYear)' 
and (CustomerNLCStatusAsOfCall = 'N/L' or CustomerNLCStatusAsOfCall = 'UnMatched')
;
Else
Activities: NoConcatenate
Load * Resident ActivitiesTEMP
where year(ActivityDate) >= '$(vResultsThruYear)'
;
End if

jasonrimkus
Contributor II
Contributor II
Author

Thank you!