Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Dear Qlik Community,
I’m looking for any smart suggestions on how I can overcome this scenario.
I have a directory full of data files which are created on a daily basis (please see attachment) but going back to the beginning of 2018.
I’m looking for a way (in the load script) to only load files reflecting the last day of each month – DailyData.20190630.csv, DailyData.20190731.csv, DailyData.20190831.csv etc.
If anyone’s come up against this or has any suggestions that’d be great.
Many thanks,
J
How about:
FOR Each file in filelist('lib://data/*.csv')
Let fdate = num(Date#(SubField('$(file)', '.', -2), 'YYYYMMDD'));
IF $(fdate) = floor(MonthEnd($(fdate))) THEN
Data:
LOAD
*,
Date($(fdate)) as FileDate
FROM [$(file)]
(txt, codepage is 28599, embedded labels, delimiter is ',', msq);
ENDIF
Next file
-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com
How about:
FOR Each file in filelist('lib://data/*.csv')
Let fdate = num(Date#(SubField('$(file)', '.', -2), 'YYYYMMDD'));
IF $(fdate) = floor(MonthEnd($(fdate))) THEN
Data:
LOAD
*,
Date($(fdate)) as FileDate
FROM [$(file)]
(txt, codepage is 28599, embedded labels, delimiter is ',', msq);
ENDIF
Next file
-Rob
http://masterssummit.com
http://qlikviewcookbook.com
http://www.easyqlik.com
Thanks Rob...yes this one is quick and optimized. 🙂
Thanks for the help Rwunderlich, Rathore01 - much appreciated.