Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
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;

1 Reply
marcus_sommer

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