Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
I need to load the only qvd's which are refreshed latest.
for example : I have qvd's jan2015 to Dec15 in the folder. I want to load the latest Qvd wwhich is Dec15 into application
How to load the qvd latest from the folder ?
Hi RGV,
try with where condition with last reloaded date.
Hi,
if your QVD files is in Specific format (like Jan2015, Feb2015 .. Dec2015), you can try the below script.
LET vFolderPath = 'C:\Users\Download\';
For Each vFile in FileList('$(vFolderPath)*.qvd')
QVDFiles:
LOAD
'$(vFile)' AS QVDFileName,
QVDCreateTime('$(vFile)') AS QVDCreateTime
Autogenerate 1;
Next vFile
NoConcatenate
Max_QVD_Check:
LOAD Date(Max(FileName),'MMMYYYY') as FileName;
LOAD MonthName(Date#(Left(SubField(QVDFileName,'\',-1),7),'MMMYYYY')) as FileName,
QVDCreateTime Resident QVDFiles;
Let vLoadFile=Peek('FileName');
DROP Table QVDFiles;
Table:
LOAD Fields
FROM [Path\'$(vLoadFile)'.qvd](qvd);
You can try the Load the QVD based on your QVDCreateTime also.
Thanks for the reply !!
I need to load the qvd with the latest loaded tme .Hope your suggestion might work for me .
Thanks
Another way could be
// month names like files name
SET MonthNames='jan;feb;mar;apr;may;jun;jul;aug;sep;oct;nov;dec';
// files folder
LET vFolderPath = '.';
// load all files
For Each vFile in FileList('$(vFolderPath)\???2015.qvd')
QVDFiles:
LOAD
'$(vFile)' AS FileName,
// file date, used in MaxFile order by
Date(Date#(Replace(SubField('$(vFile)', '\', -1), '.qvd', ''), 'MMMYYYY'), 'YYYYMMDD') as FileDate
Autogenerate 1;
Next vFile
// load only 1 record, the one with the last month (because of order by filedate desc)
MaxFile:
First 1 LOAD FileName
Resident QVDFiles
Order by FileDate desc;
// variable with the last file (more recent)
Let vLoadFile=Peek('FileName');
DROP Table QVDFiles, MaxFile;