Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

How do I check a list of qvd and get the last one created?

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.

1 Solution
5 Replies
swuehl
MVP
MVP

There was a similar request today, maybe this helps also to resolve your request:

Dynamic Load of a QVD

maxgro
MVP
MVP

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);

Not applicable
Author

That works, I had to change my code to use this method but it went well, thank you.

Not applicable
Author

Good way to do it, didn't use right now but I saved it for another time. Thank you.