Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
clarachac
Contributor III
Contributor III

Load a file with a MaxDate

Hello,

I have multiple files stocked in a repository by date, for example we have the files : 20240226_XXX and 20240224_XXX ...
But in the same repository I have multiple other files with different names, for example : 20240224_YYY

I want to load the file XXX with the most recent date in my qliksense app.

Labels (3)
1 Solution

Accepted Solutions
marksouzacosta

Hi @clarachac ,

There are multiple solutions for this problem and without knowing exactly what you have is hard to give you the best solution. However, I can point you to a good direction.

You can use * character to load files with a common name pattern.
In your case, if the files are QVDs:
LOAD * FROM [*_XXX.qvd](qvd);

This will combine all files where the name ends with "_XXX.qvd".

Now, if you are looking to get ONLY the most recent file (the latest) with that name pattern, then you can do something like this:

For Each vFilename in FileList('lib://MyLib/*_XXX.qvd')
// Do nothing here
Next vFilename
 
LOAD * FROM [$(vFilename)](qvd); // The loop will return your latest listed file
Read more at Data Voyagers - datavoyagers.net

View solution in original post

1 Reply
marksouzacosta

Hi @clarachac ,

There are multiple solutions for this problem and without knowing exactly what you have is hard to give you the best solution. However, I can point you to a good direction.

You can use * character to load files with a common name pattern.
In your case, if the files are QVDs:
LOAD * FROM [*_XXX.qvd](qvd);

This will combine all files where the name ends with "_XXX.qvd".

Now, if you are looking to get ONLY the most recent file (the latest) with that name pattern, then you can do something like this:

For Each vFilename in FileList('lib://MyLib/*_XXX.qvd')
// Do nothing here
Next vFilename
 
LOAD * FROM [$(vFilename)](qvd); // The loop will return your latest listed file
Read more at Data Voyagers - datavoyagers.net