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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
mp802377
Creator II
Creator II

Load multiple qvds from folder based on date (files in folder have a file name like DIFFERENCE_DAILY_LOGS_20210121_19.QVD

Load Mulitple Qlikview files based on name in file

I have an app that is pulling in hourly data and storing it as a QVD. I have to do this because the dataset is quite large. It errors out if I try to pull in a day. I had a query working for just grabbing a day before the dataset got too large to where I had to break it up hourly. In the DEV environment we have a config file that says daysofData = 5, in production the config file has daysofData = 30 (the days of data is always subject to change, hence a variable stored in a config file). The log files are every day for the past 2 months each broken up from hour 00 to hour 23. I am completely stumped on how to do this. Any ideas? Thank you so much for any help you can provide.

 

daysOfData = 5

location of folder: $(vQVDFiles)\Raw\

DIFFERENCE_DAILY_LOGS_20210122_23.QVD
DIFFERENCE_DAILY_LOGS_20210122_22.QVD
DIFFERENCE_DAILY_LOGS_20210122_21.QVD
DIFFERENCE_DAILY_LOGS_20210122_20.QVD
DIFFERENCE_DAILY_LOGS_20210122_19.QVD
DIFFERENCE_DAILY_LOGS_20210122_18.QVD
DIFFERENCE_DAILY_LOGS_20210122_16.QVD
DIFFERENCE_DAILY_LOGS_20210122_15.QVD
DIFFERENCE_DAILY_LOGS_20210122_14.QVD
....
..

DIFFERENCE_DAILY_LOGS_20210121_23.QVD
DIFFERENCE_DAILY_LOGS_20210121_22.QVD
DIFFERENCE_DAILY_LOGS_20210121_21.QVD
DIFFERENCE_DAILY_LOGS_20210121_20.QVD
DIFFERENCE_DAILY_LOGS_20210121_19.QVD
DIFFERENCE_DAILY_LOGS_20210121_18.QVD
DIFFERENCE_DAILY_LOGS_20210121_16.QVD
DIFFERENCE_DAILY_LOGS_20210121_15.QVD
DIFFERENCE_DAILY_LOGS_20210121_14.QVD


LogFact:
LOAD
*
From [$(vQVDFiles)\Raw\DIFFERENCE_DAILY_LOGS_$(v_Date)*.QVD] (qvd);

Labels (2)
1 Reply
edwin
Master II
Master II

one way is to generate a for next loop using file format 
DIFFERENCE_DAILY_LOGS_$(vDATE)_*.QVD
but the trick is how to generate a list with the desired dates between a date and date-5 or 30
one way is to create a for next loop using a list of the dates:

set vDays=5;
Dates:
load concat(chr(39) & Date & chr(39),',') as Date;
load date(today()+iterno()-1,'YYYYMMDD') as Date while iterno()<=$(vDays);
load 1 AutoGenerate(1);

let vDates=peek('Date',0,Dates);

NoConcatenate
data:
load null() as D
AutoGenerate(0);

for each vD in $(vDates)
	for each vFile in [DIFFERENCE_DAILY_LOGS_$(vD)_*.qvw]
	next
next;