Discussion Board for collaboration on QlikView Scripting.
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'
FROM [$(File)] (qvd);
The above is not working.
Any help is highly appreciated.
Go to Solution.
Remove the Concat and then try this
SET vFolder = '\\Folder\';
FOR i=1 to $(NumRows)
LET vFile = FieldValue('%DateKey', $(i));
FROM [$(vFolder)\$(vFile).qvd] (qvd);
What do you mean, not working? Script Error? Can you post the expanded load statement from the document log and the error message?
Look at the first example here:
// LOAD the files 1.csv, 3.csv, 7.csv and xyz.csv
for each a in 1,3,7,'xyz'
I think Rob, the issue is that vFilenames expand to this:
FOR EACH File in FileList('$(vFolder)\abg, dhjk, qwe, qwee, gsdf.QVD') //Storing filenames in the variable 'File'
Which is not what he wants, I believe
The filename were not being read / the file names have to be expanded individually.
So for you, may be this:
FOR EACH File in 'abg', 'dhjk', 'qwe', 'qwee', 'gsdf'
FROM [$(vFolder)\$(File).qvd] (qvd);
Do we have to hard code the file names?
I was trying to store file names in variable.
As the file names keep changing.
Not tested, but may be like this:
SET vFilenames = 'abg', 'dhjk', 'qwe', 'qwee', 'gsdf';
FOR EACH File in $(vFilenames)
It is not working:
LET vFilelist = peek('DateKey'); //I'm readin this from another table. This has the dynamic list of file names
FOR EACH File in $(vFilelist)
The file names are not getting read by the script in the for loop
Is this a list or a single date?