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

Announcements
Posting on Qlik Community is temporarily paused for some users. Thank you for patience and we'll update you soon!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Do while loop

Hi all,

I have problem with do while loop .Its not quiting the loop even after meeting the   condition.

It is continuously running the loop.

Here is my code

do while vweekstart<=vweekend

let vnewweekend =date(date#(vweekstart)+6);

fct_sales:

Select * from FctSales where DATE_KEY BETWEEN '$(vweekstart)' AND '$(vnewweekend)'

let file = Year(date#(vweekstart))&week(date#(vweekstart));

trace file= $(file);

//Store and Drop Table

STORE FCT_DAILY_SALES INTO [./Qvd/$(file).QVD];

DROP TABLE FCT_SALES;

let vweekstart = date(date#(vweekstart)+7);

LOOP;

Labels (1)
1 Reply
marcus_sommer
MVP
MVP

I think you should put some trace-statements within your which return your do while variables, especially something like vweekstart - vweekend to see could it be calculated. In general it's recommended to use for each calculation or comparison numeric values, maybe something like this:

do while num($(vweekstart)) <= num($(vweekend))

and uncomment your select-load for the testings.

- Marcus