Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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
That's right. -1 is equivalent to true.
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
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?
That's right. -1 is equivalent to true.