Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
QFanatic
Creator
Creator

Determine if a range of qvd's exist

hi all

I have range of file_names, per day on a folder....Potentially, the filenames look like this...

File_15-Sep-21_0100

File_15-Sep-21_0200 etc 

I want to determine, in code if even one file exists that contain data for 15 Sept...so I dont really care about what follows 15-Sep_21.....

if I find one match (or more - doesnt matter) I want to set a variable to true - to indicate I found data for the 15th...

Currently my code looks like this..

let vPath_All = '$(vQvData)STATS_' & '$(vToday)' & '*.qvd';

For Each File in filelist(vPath_All)
MyTable:
load
'$(File)' as Filename,
RowNo() as ROW

from
[$(File)] (qvd);
next File;

Then I test if the value of column (ROW) is > 0 - if it is then vFound = 1, else vFound = 0.

Is there a more 'eloquent' way of testing for this? Unfortunately, I would only have the value of the date part (15 Sept 2021), and not the rest of the filename.

 

thanks

 

Labels (1)
1 Solution

Accepted Solutions
stevejoyce
Specialist II
Specialist II

That's right.  -1 is equivalent to true.  

View solution in original post

3 Replies
stevejoyce
Specialist II
Specialist II

Not sure if/how much more eloquent this is, but to see if a fileexists i check for file size, so something like this:

 

let vLogFile_FileExists = Filesize('lib://Source Files/Logs/$(logfile_childname)_log.txt') > 0;

If $(vLogFile_FileExists) then

  <whatever you want, load file>

End if

QFanatic
Creator
Creator
Author

hi Steve

Thank you for your response.

It looks like it resolves to a value -1 if the files exist and a null if it doesnt?

 

 

 

 

stevejoyce
Specialist II
Specialist II

That's right.  -1 is equivalent to true.