Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
williamdeboos
Contributor
Contributor

How to only load .qvd files that are 30 days or less old?

Hi,

On a daily basis, a process is run whereby data is imported and saved down into a new .qvd file as FileName_DD-MM-YYYY.qvd. I am looking to add some logic within my Qlik script to only pull back .qvd files that are a month or less old. The files themselves do not have any date information within them but the as of date is saved in the file name and could also be pulled back from the Date Modified info (I am thinking filetime() function).

Please could you let me know how I could limit the historical .qvd files to pull back based on their name/timestamp? At the moment my script which is not working looks like:

Load

         Field1,

         Field2

From [Filepath\FileName_*.qvd] where filetime([Filepath\FileName_*.qvd]) >= Today()-30;

 

Any ideas, very appreciated 🙂

1 Solution

Accepted Solutions
yasmeenk
Partner - Creator
Partner - Creator

Hi,

Try the below script.

Load

Field1,

Field2

From [Filepath\FileName_*.qvd] (qvd) WHERE date(FileTime())>=Today()-30;

 

Thanks,

Yasmeen

View solution in original post

2 Replies
yasmeenk
Partner - Creator
Partner - Creator

Hi,

Try the below script.

Load

Field1,

Field2

From [Filepath\FileName_*.qvd] (qvd) WHERE date(FileTime())>=Today()-30;

 

Thanks,

Yasmeen

williamdeboos
Contributor
Contributor
Author

Thanks very much Yasmeen, that has worked!

One small question, at the moment, the script is still trying to load all files but will not import any data if the date is over 30 days old. Is there a way for the file to simply ignore those other files to help speed up the script part?