Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
michaeldburt
Partner - Contributor III
Partner - Contributor III

Dynamic Load of a QVD

Hello Everyone-

I am trying to write a script that will dynamically choose and load a QVD based on the QVD being the latest loaded version.

For background, I have an app that loads data from a table, and creates a QVD named [Table__$(vTimeStamp)]

In a separate app, I'm trying to load the newest version, or the most current "Timestamp" QVD.

Does anyone have experience with this type of situation?

1 Solution

Accepted Solutions
swuehl
MVP
MVP

You can scan all QVDs in your folder, creating a table with filenames, like

For Each vFile in FileList('$(FolderPath)\Table_*.qvd')

Files:

LOAD '$(vFile)' as Name,

        SubField(Subfield('$(vFile)','_',-1),'.qvd',1) as Timestamp //here you parse the timestamp,may need to adapt, also                                                                                              // using Timestamp#() to interprete as timestamp

AutoGenerate 1;

Next vFile

Then search for max timestamp:

TMP:

LOAD FirstSortedValue( Name, -Timestamp) as LastFileName

Resident Files;

Let vLastFile = Peek('LastFileName',0,'TMP');

View solution in original post

2 Replies
swuehl
MVP
MVP

You can scan all QVDs in your folder, creating a table with filenames, like

For Each vFile in FileList('$(FolderPath)\Table_*.qvd')

Files:

LOAD '$(vFile)' as Name,

        SubField(Subfield('$(vFile)','_',-1),'.qvd',1) as Timestamp //here you parse the timestamp,may need to adapt, also                                                                                              // using Timestamp#() to interprete as timestamp

AutoGenerate 1;

Next vFile

Then search for max timestamp:

TMP:

LOAD FirstSortedValue( Name, -Timestamp) as LastFileName

Resident Files;

Let vLastFile = Peek('LastFileName',0,'TMP');

michaeldburt
Partner - Contributor III
Partner - Contributor III
Author

This was exactly what I had in mind.  I had to change the code around a bit but the framework is excellent.  Thank you for the assist!