Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
Can anyone help me on below requirement.
I have multiple Qvd files with naming as below
1.Products_New_202201.qvd
2.Products_New_202112.qvd
3.Products_New_202111.qvd
4.Products_New_202110.qvd
Here I need to load only latest two months files from the folder also files don't have the date fields.
please help me on this
@379SSS try below
let vFolderPath ='lib://Store QVD/Data';
Files:
first 1 LOAD
SubField(FileBaseName(),'_',-1) as FileMonth,
FileName() as FileName
FROM [$(vFolderPath)/Products_New_*.qvd]
(qvd);
Latest2Months:
first 2 load FileName
Resident Files
Order by FileMonth desc;
Drop Table Files;
Data:
Load 0 as Temp
AutoGenerate 0;
for i=1 to FieldValueCount('FileName')
let vFileName = FieldValue('FileName',$(i));
Concatenate(Data)
Load *
FROM [$(vFolderPath)/$(vFileName)]
(qvd);
Next
Drop Field Temp;
Drop Table Latest2Months;
@379SSS try below
let vFolderPath ='lib://Store QVD/Data';
Files:
first 1 LOAD
SubField(FileBaseName(),'_',-1) as FileMonth,
FileName() as FileName
FROM [$(vFolderPath)/Products_New_*.qvd]
(qvd);
Latest2Months:
first 2 load FileName
Resident Files
Order by FileMonth desc;
Drop Table Files;
Data:
Load 0 as Temp
AutoGenerate 0;
for i=1 to FieldValueCount('FileName')
let vFileName = FieldValue('FileName',$(i));
Concatenate(Data)
Load *
FROM [$(vFolderPath)/$(vFileName)]
(qvd);
Next
Drop Field Temp;
Drop Table Latest2Months;
Thanks! @Kushal_Chawda . It's working now 😊