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: 
GraysonStack
Contributor II
Contributor II

Getting the latest source

Hi, I'm not sure if this board is the right place to put a question like this, but I was wondering if there was a way to automate getting the latest version of a file from my source?

 

Table_Name:  
LOAD
Field1,
Field2
FROM [FilePath/File/FileName 2.12.24.xlsx]
(ooxml, embedded labels, table is [Table Name]);

 

 

For instance, in the FROM section of a load above, how would I go about automating grabbing the latest version of the FileName file?

The naming convention will always be FileNamm MM.DD.YY.xlsx

How could I set it up to automatically grab the file that will be added to the source on 2.22.2024 without having to change the code weekly to reflect the new file?

Labels (1)
1 Reply
henrikalmen
Specialist
Specialist

Iterate over all of the files matching for example the pattern "FileName *.*.*.xlsx" using a for-loop with FileList(), and then check each file's name for the latest date, or use FileTime(). Store the filename that you need (i.e. the filename of the latest file) into a varable, and use the contents of that variable when loading, e.g FROM [FilePathe/File/$(filenameOfLatestFile)].