Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I have below qvd files in my source folder.
I want to load files from 2019 Week 48 on wards. Please help me to form the scripting
Data_2019_Week45.qvd
Data_2019_Week46.qvd
Data_2019_Week47.qvd
Data_2019_Week48.qvd
Data_2019_Week49.qvd
Data_2019_Week50.qvd
Data_2019_Week51.qvd
Data_2019_Week52.qvd
Data_2020_Week1.qvd
Data_2020_Week2.qvd
Data_2020_Week3.qvd
Data_2020_Week4.qvd
So on…..
Hi,
I know there are many ways to do this,
but I propose you a gymnastics solution (because I love this game 😁)
if I load the initial data ( I added a field to see what I loaded )
I get the result
there are two elements in the filenames the year and the week.
so I use those two elements to create a date.
and then before loading the qvd file I check if the created date (which is in the qvd file name) is higher than your reference date which is week 48 of 2019
so the scrip is :
let week48=MakeWeekDate(2019,48);
for each File in filelist ('.\test2\*.qvd')
let vmatch = MakeWeekDate(num(TextBetween('$(File)','Data_','_Week')),num(TextBetween('$(File)','_Week','.qvd'))) ;
if '$(vmatch)'>'$(week48)' then
Data:
LOAD *
FROM
$(File)
(qvd);
end if
next File
and the result :
Hi,
I know there are many ways to do this,
but I propose you a gymnastics solution (because I love this game 😁)
if I load the initial data ( I added a field to see what I loaded )
I get the result
there are two elements in the filenames the year and the week.
so I use those two elements to create a date.
and then before loading the qvd file I check if the created date (which is in the qvd file name) is higher than your reference date which is week 48 of 2019
so the scrip is :
let week48=MakeWeekDate(2019,48);
for each File in filelist ('.\test2\*.qvd')
let vmatch = MakeWeekDate(num(TextBetween('$(File)','Data_','_Week')),num(TextBetween('$(File)','_Week','.qvd'))) ;
if '$(vmatch)'>'$(week48)' then
Data:
LOAD *
FROM
$(File)
(qvd);
end if
next File
and the result :
It works like a charm. Thanks 🙂