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

Announcements
Want to see what's currently in public preview? We've pulled it all together in one place. Check it out here
cancel
Showing results for 
Search instead for 
Did you mean: 
Ron1
Partner - Creator
Partner - Creator

QlikSense QVD load based on naming pattern - Advanced

I have below qvd files in my library location. I only want to load data from AUXFILE_2018_05.qvd to rest all (The objective is to load data from Year-Month 2018_05 to rest all. How to transform my existing code(Given below) (presently it is loading from all the QVDs in the location)?

****My Code****

Set vStartYear = 2018;
Let vCurrentYear= year(now());
For vYear = $(vStartYear) to $(vCurrentYear)

DTA:

LOAD
ID,
Region,
Country

FROM [lib://CID/AUXFILE_$(vYear)*.qvd]
(qvd);

store DTA into [lib://STR/DTA_$(vYear).qvd));

next vYear

***************************

Source QVD Files:

AUXFILE_2018_03.qvd
AUXFILE_2018_04.qvd
AUXFILE_2018_05.qvd
AUXFILE_2018_06.qvd
AUXFILE_2018_07.qvd
AUXFILE_2018_08.qvd
AUXFILE_2018_09.qvd
AUXFILE_2018_10.qvd
AUXFILE_2018_11.qvd
AUXFILE_2018_12.qvd
AUXFILE_2019_01.qvd
AUXFILE_2019_02.qvd
AUXFILE_2019_03.qvd
AUXFILE_2019_04.qvd
AUXFILE_2019_05.qvd
AUXFILE_2019_06.qvd

 

1 Reply
jyothish8807
Master II
Master II

Hi Ron, 

Try like this:

LET FileCount = 0;

LET MinFileDate = 201805;

FOR Each File in FileList ('yoursourcepath\AUXFILE_*.qvd');

LET FileDate = num(replace(replace(right('$(File)',11),'_',''),'.qvd',''));

IF $(FileDate) > $(MinFileDate) THEN

LET FileCount = $(FileCount)+1;


LOAD
ID,
Region,
Country

FROM [$(File)](qvd);

ENDIF

NEXT File;

 

Br,

KC

Best Regards,
KC