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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

for loop or do while

Hi Gurus,

I have one csv files for each day like exportfile-2010-01-01.csv . Starting for 01/01/2010 .. i am able to load the today file using

Datafile:

Load ...

.......

.......

FROM
.

Store datafile into C:\QlikView\DevelopmentDocuments\QVD Files\exportfile_$(vtoday).qvd

so it generates one qvd file each day.

but i want generate the backdate files ( starting from 01/01/2010 to 21/03/2010) using loop condition.

Could you please tell me how it can be done in qlikview.

3 Replies
Not applicable
Author

Try something like this (parts borrowed from a Calender creation script)


LET vDateMin = Num(MakeDate(2010,1,1));
LET vDateMax = Num(Today());

// Autoload data files
TempTable:
LOAD *,
Date($(vDateMin),'YYYY-MM-DD') AS LoadDate
FROM exportfile-Date($(vDateMin),'YYYY-MM-DD').csv (csv)
WHILE $(vDateMin)+IterNo()-1<= $(vDateMax);


It should concatenate all the date csv-files from 2010-01-01 till today.

Not sure if it still works when a file is missing (like if you don't generate a csv-file on sundays).

Not applicable
Author

Hi Mark,

It is just loading only 01/01/2010 file.

Not applicable
Author

This should work better 😉


LET vDateMin = Num(MakeDate(2010,1,1));
LET vDateMax = Num(Today());

FOR a=$(vDateMin)

DO WHILE a <= $(vDateMax)

TempTable:
LOAD *,
Date(a,'YYYY-MM-DD') AS LoadDate
FROM exportfile-Date(a,'YYYY-MM-DD').csv (csv);

LET a=a+1;

LOOP