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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
louisernould
Contributor III
Contributor III

Load a file in the last folder

Hello everybody,

I have a new problem and I think you guys will be able to solve it with me.

I have one folder (name: extract) , which is full of monthly extractions (names: 201407,201408,201409,...). In each folder, I have one file (name: Product.csv) and I want to select the file 'product' in the last folder (the new one) each month.

So, I want my script like that:

LOAD

@1

@2

@3

@4

from ['The file Product.csv from the last folder']

I tried something else with:

for each File in filelist ('G:Extract\*') But I don't know how to select the last folder...

If someone knows how to solve it... and wants to help a poor newbee 

Thanks

Louis

12 Replies
demoustier
Creator
Creator

or:

Step 2:

FOLDER_table:

load

right(dirname,len(dirname)-Index(dirname,'\',-1)) as folder_name Resident DIRNAME;

folder_list:

NoConcatenate

LOAD folder_name Resident FOLDER_table Order BY folder_name;

drop Table FOLDER_table;

and you should have now the list of your folder order by asc.

You chosse the last one by peek function in a variable and use the variable in your Load* from...

but not sure it's works. depending your folder_name list....

demoustier
Creator
Creator

Final step should be:

let vfolder=Peek('folder_name',-1,'folder_list');

DATA:

LOAD * From 'G:\Extract\'$(vfolder)'\Products.csv'

louisernould
Contributor III
Contributor III
Author

Thank You so much desmoutier & Gysbert !!!!

It works soooo well

Thank you for your help