Do..loop
The do..loop control statement is a script iteration construct which executes one or several statements until a logical condition is met.
Syntax:
Do [ ( while |
until ) condition ] [statements]
[exit do [ ( when | unless )
condition ] [statements]
loop[ ( while | until ) condition ]
Arguments:
Argument | Description |
---|---|
condition |
A logical expression evaluating to True or False. |
statements |
Any group of one or more Qlik Sense script statements. |
while / until |
The while or until conditional clause must only appear once in any do..loop statement, i.e. either after do or after loop. Each condition is interpreted only the first time it is encountered but is evaluated for every time it encountered in the loop. |
exit do |
If an exit do clause is encountered inside the loop, the execution of the script will be transferred to the first statement after the loop clause denoting the end of the loop. An exit do clause can be made conditional by the optional use of a when or unless suffix. |
Example:
// LOAD files file1.csv..file9.csv
Set a=1;
Do while a<10
LOAD * from file$(a).csv;
Let a=a+1;
Loop