Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

FOR-loops, STORE and dynamic file names.

Hi!

I have a question regarding FOR-loops. I want to, in my script, basically iterate through my Date-field and save my Articlenumber and Inventoryvalue (fields) for that date into seperate qvd-files for each date

Anyone got any example of this?

Thanks!

1 Solution

Accepted Solutions
Miguel_Angel_Baeyens

Hello,

It should look like the following

PossibleValues:LOAD CONCAT(Date, chr(39) & ', ' & chr(39)) AS AllDatesRESIDENT Sales; LET vPossibleDates = chr(39) & Peek('AllDates', 0) & chr(39); FOR EACH vDate IN $(vPossibleDates) Temp: NOCONCATENATE LOAD * RESIDENT Sales WHERE Date = '$(vDate)'; STORE Temp INTO File_$(vDate).qvd; DROP TABLE Temp; NEXT


Please take into account that loops are very slow and would result in poor performance and longer loading scripts.

Hope this helps

View solution in original post

2 Replies
Miguel_Angel_Baeyens

Hello,

It should look like the following

PossibleValues:LOAD CONCAT(Date, chr(39) & ', ' & chr(39)) AS AllDatesRESIDENT Sales; LET vPossibleDates = chr(39) & Peek('AllDates', 0) & chr(39); FOR EACH vDate IN $(vPossibleDates) Temp: NOCONCATENATE LOAD * RESIDENT Sales WHERE Date = '$(vDate)'; STORE Temp INTO File_$(vDate).qvd; DROP TABLE Temp; NEXT


Please take into account that loops are very slow and would result in poor performance and longer loading scripts.

Hope this helps

Not applicable
Author

I found a similar way to yours that did it bu´t your idea works too, thanks!