This article will cover the syntax of the ‘if… then’ control script statement.
This is a logical statement. Different parts of the statement will be executed given the conditions met.
Statement syntax
If condition then [ statements ]
{ elseif condition then [ statements ] }
[ else [ statements ] ]
end if
Statements | Qlik Sense statements to be executed given met conditions. |
Condition | The conditional statements to be evaluated to determine whether to execute the script part. The statements must evaluate to True or False. |
Example
This example will exit the script if the day of the week is a Sunday but will reload the data otherwise.
If weekday(Today())=6 then
Exit script;
Else
LOAD * INLINE [
FIELD,
1
];
End if
Result
Today is a Wednesday therefore the script to load an inline table is executed.