Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
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