Skip to main content
Woohoo! Qlik Community has won “Best in Class Community” in the 2024 Khoros Kudos awards!
Announcements
Nov. 20th, Qlik Insider - Lakehouses: Driving the Future of Data & AI - PICK A SESSION
cancel
Showing results for 
Search instead for 
Did you mean: 
a-5
Contributor III
Contributor III

Loading data from multiple qvd files including weekly data

I have weekly data in qvd files (meaning I have one qvd file for each week). qvd file names are otherwise the same, but at the end I have the date changing - e.g. SNAPSHOT_20231016.qvd, SNAPSHOT_20231023.qvd & SNAPSHOT_20231030.qvd. 

Now, I need to get the snapshot data from the last 20 weeks.

How can I load the data from these qvd files so that the latest 20 weekly files are read? What kind of script needs to be placed into Data load editor?

Thank you for your assistance! 

Labels (1)
1 Solution

Accepted Solutions
Adam_Romanowski
Partner - Contributor III
Partner - Contributor III

This code will generate names of qvd files for latest 20 weeks

 

 

 

 

let vStartDate=num(today())-19*7;
let vEndDate=num(today());
Dates:
Load
	distinct 
	date(weekstart(Date($(vStartDate) + IterNo()-1)),'YYYYMMDD') as qvdDate
	autogenerate 1
WHILE $(vStartDate) + IterNo()-1 <= $(vEndDate);

for i=0 to NoOfRows('Dates')-1
	let vQvdFileDate=Peek('qvdDate', i, 'Dates');
    //LOAD * FROM [lib://Dane QVD/SNAPSHOT_$(vQvdFileDate).qvd] (qvd);
next i;

 

 

 

 

View solution in original post

2 Replies
Adam_Romanowski
Partner - Contributor III
Partner - Contributor III

This code will generate names of qvd files for latest 20 weeks

 

 

 

 

let vStartDate=num(today())-19*7;
let vEndDate=num(today());
Dates:
Load
	distinct 
	date(weekstart(Date($(vStartDate) + IterNo()-1)),'YYYYMMDD') as qvdDate
	autogenerate 1
WHILE $(vStartDate) + IterNo()-1 <= $(vEndDate);

for i=0 to NoOfRows('Dates')-1
	let vQvdFileDate=Peek('qvdDate', i, 'Dates');
    //LOAD * FROM [lib://Dane QVD/SNAPSHOT_$(vQvdFileDate).qvd] (qvd);
next i;

 

 

 

 

a-5
Contributor III
Contributor III
Author

Hi Adam! Thank you - this works perfectly! Much appreciated 🙏