Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Do While

Hi,

Can any one explain do while statement in qlikview with sample example........

thanks & regards

siva

4 Replies
marcus_sommer

Here is a very good explanation on how to use loops within qlikview: Loops in the Script. Differences between the various loop-variants lie in the fact how and on which place are the conditions are checked - details could you find here: Control flow - Wikipedia, the free encyclopedia

- Marcus

maxgro
MVP
MVP

you can find an example in the Qlik help

Examples:

// load files file1.csv..file9.csv

Set a=1;

Do while a<10

     Load * from file$(a).csv;

     Let a=a+1;

Loop

engishfaque
Specialist III
Specialist III

Dear Siva,

Here is a Do While loop syntax and example,

Do While 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 ]

Where:

condition        is a logical expression evaluating to true or false.

statements      is any group of one or more QlikView script statements.

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.

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.

Since the do..loop statement is a control statement and as such is ended with either a semicolon or end-of-line, each of its three possible clauses (do, exit do and loop) must not cross a line boundary.

Examples:

Set a=1;

     Do while a<10

          Load * from file$(a).csv;

          Let a=a+1;

     Loop

For detail understanding, please go through QlikView Reference Manual, Page No. 236.

Kind regards,

Ishfaque Ahmed

Peter_Cammaert
Partner - Champion III
Partner - Champion III

Ah, the great QlikView Help articles that nobody seems to find