Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi folks,
I'm stuck with a extraction that load data day a day from an oracle database. I'm creating one qvd for each month, when the month ends, another qvd is created and so go on.
I wanted to check the last qvd created and then check the last day that qvd have, so I can add the next day data in it. But not making a loop that look all filed in all files, but checking only by the date that the file was created or by the name of the file, for the qvd file are named with year/month in it, for example: "table_201603.qvd".
Putting the result of QvdCreateTime in a variable seems be reasonable to use but I don't know yet how to make it check all files in the folder where all the qvd are stored.
There was a similar request today, maybe this helps also to resolve your request:
for last file, using the file name (table_YYYYMM.qvd) you can use
For Each vFile in FileList('table_??????.qvd')
Files:
LOAD
'$(vFile)' as Name,
mid(SubField('$(vFile)', '\', -1), 7, 6) as YearMonth
AutoGenerate 1;
Next;
TMP:
NoConcatenate First 1
LOAD * Resident Files
Order by YearMonth desc;
DROP Table Files;
Let vLastFile = Peek('Name',0,'TMP');
trace $(vLastFile);
That works, I had to change my code to use this method but it went well, thank you.
Good way to do it, didn't use right now but I saved it for another time. Thank you.