Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi All,
The below chunk of code does not give me the desired output. I am trying to skim through all filenames in a folder and extract the maximum date. Please let me know what might be wrong here:
// -----------------------------------------------------------
Let vMaxMonthYear = MakeDate(1900);
For Each vFile in FileList('$(viTimeSQLExtracts)' & 'IPower_Monthly*.qvd')
Let vCurMonthYear = MonthEnd(MakeDate(subfield('$(vFile)', '_', 3), subfield('$(vFile)', '_', 4)));
If $(vCurMonthYear) > $(vMaxMonthYear) then
LET vMaxMonthYear = $(vCurMonthYear);
End If
Next vFile
// For testing purpose only
Let vTest_CurMonthYear = MonthEnd(MakeDate(subfield('$(vFile)', '_', 3), subfield('$(vFile)', '_', 4)));
Trace $(vTest_CurMonthYear);
Trace 'Latest Month: $(vMaxMonthYear)';
You should check viTimeSQLExtracts variable.
Does it contains the full path to your qvd´s?
You should check viTimeSQLExtracts variable.
Does it contains the full path to your qvd´s?
Yes, that was the culprit. Apparently if the variable is not able to find the path, it doesn't throw an error.
Thanks for the help.