Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

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.

Tags (1)
1 Solution

Accepted Solutions
Chanty4u
Esteemed Contributor III

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

5 Replies
Chanty4u
Esteemed Contributor III

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

MVP
MVP

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

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

Dynamic Load of a QVD

MVP
MVP

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

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

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

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

Not applicable

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

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