Qlik Community

Qlik Sense App Development

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

Announcements
BARC’s The BI Survey 19 makes it official. BI users love Qlik. GET REPORT
chrishayes
New 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 (2)
1 Reply

Re: Do... While... Loop...

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