Qlik Community

App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Now Live: Qlik Sense SaaS Simplified Authoring – Analytics Creation for Everyone: READ DETAILS
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