Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
umanikhat
Contributor
Contributor

Need Help with looping through dates

Hi,

I am trying to store qvds based on each single day. I have the data In db as

Id, start, end 1, 1/1/2022, 1/30/2022

The above record was actually stored as one record in db but the record was available for 30 days. So in general I need 30 qvds with same record showing up. I was able to get the records seperated out but need help in storing the qvds using loop instead of manually doing the work.

Please provide your thoughts. Any help is highly appreciated!!

Labels (1)
  • Other

1 Reply
Vegar
MVP
MVP

Try something like this.

set vStartDate = yearstart(today());

set vEndDate = yearstart(today(),-1);

For _date = vStartDate to vEndDate

DayData:

NoConcatenate Load '$(_date)' as Date,  id From Source 

Where [end]>=$(_date) and [start] <=$(_date);

Store DayData into Lib://QVD/Data_$(_date).qvd (Qvd);

Drop Table DayData;

Next _date