Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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?
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');
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');
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!