Skip to main content
Announcements
Have questions about Qlik Connect? Join us live on April 10th, at 11 AM ET: SIGN UP 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)
  • Loop

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