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: 
markgraham123
Specialist
Specialist

load files with specific names from folder through for loop

Hi all,

I'm trying to load 5 files from the folder of 1000 files.

I have stored file names in vFilenames.

vFilenames = abg, dhjk, qwe, qwee, gsdf;

How can i load only these 5 files from the folder, instead of loading all files and then filtering by the filebasename()?

FOR EACH File in FileList('$(vFolder)\$(vFilenames).QVD')  //Storing filenames in the variable 'File'  

      Table1:

      LOAD *

  FROM [$(File)] (qvd);

NEXT

The above is not working.

Any help is highly appreciated.

30 Replies
Anonymous
Not applicable

My 2 cents....

If you had to stay with the comma delimited variable, I'd have gone with:

Set vFileList='201601,201602,201603';

Set vFolder = '\\Folder\';

let FileCount=SubStringCount((vFileList),',')+1;

FOR i=1 to $(FileCount)

Let vFile=SubField(vFileList,',',$(i));

Let vQVD= (vFolder) & '\'& $(vFile) & '.qvd';

        Table1:

      LOAD *

  FROM $(vQVD)(qvd);

NEXT