Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
rammuthiah
Creator III
Creator III

Load data based on max date

I tried loading data based on max date from file name.

While trying to call in a variable, it's not working.

Is there any way to loa

Capture.JPG

13 Replies
agigliotti
Partner - Champion
Partner - Champion

could you provide a sample app with mock data ?

agigliotti
Partner - Champion
Partner - Champion

set vMaxDate = 0;

FOR Each File in filelist ('.\your_path\*.xlsx')

     set vFileNameDate = date#(left(FileBaseName(), 10),'YYYY-MM-DD');

     set vFileNameNumDate = num( replace( vFileNameDate, '-', '') );


     if $(vFileNameNumDate) > $(vMaxDate) then

          set vMaxDate = $(vFileNameNumDate);

          set vFileNameMax = FileBaseName();

     end if

 

NEXT File;

// finally load your last excel file

LOAD

...

from '$(vFileNameMax)'

(ooxml, embedded labels, table is Sheet1);

rammuthiah
Creator III
Creator III
Author

For loop works fine for me

rammuthiah
Creator III
Creator III
Author

For loop works well. Thanks for your hint