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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
lightsection
Contributor III
Contributor III

Filelist loop not working

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)';

1 Solution

Accepted Solutions
Clever_Anjos
Employee
Employee

You should check viTimeSQLExtracts variable.

Does it contains the full path to your qvd´s?

View solution in original post

2 Replies
Clever_Anjos
Employee
Employee

You should check viTimeSQLExtracts variable.

Does it contains the full path to your qvd´s?

lightsection
Contributor III
Contributor III
Author

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.