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

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
chrishayes
Contributor III
Contributor III

Do... While... Loop...

Helpful tip for others:

While the help documentation indicates that you can set your condition at the beginning of the statement using WHILE, I found that the condition was not being triggered and the loop would go on until I aborted the script. When I moved the condition to the end, it worked as expected.

SET v_loop = 1;

DO

TRACE Loop Number: $(v_loop);

LOOP WHILE $(v_loop) <= 10

 

Labels (1)
1 Reply
sunny_talwar

Not sure why, but this works

SET v_loop = 1;

DO WHILE v_loop <= 10
LET v_loop = $(v_loop) + 1;

TRACE Loop Number: $(v_loop);

LOOP

but this doesn't

SET v_loop = 1;

DO WHILE $(v_loop) <= 10
LET v_loop = $(v_loop) + 1;

TRACE Loop Number: $(v_loop);

LOOP