Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
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.
Remove the Concat and then try this
LET NumRows=FieldValueCount('%DateKey');
SET vFolder = '\\Folder\';
FOR i=1 to $(NumRows)
LET vFile = FieldValue('%DateKey', $(i));
Table1:
LOAD *
FROM [$(vFolder)\$(vFile).qvd] (qvd);
NEXT
What do you mean, not working? Script Error? Can you post the expanded load statement from the document log and the error message?
-Rob
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'
LOAD *
from file$(a).csv;
next
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'
Table1:
LOAD *
FROM [$(File)] (qvd);
NEXT
Which is not what he wants, I believe
Rob,
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'
Table1:
LOAD *
FROM [$(vFolder)\$(File).qvd] (qvd);
NEXT
Sunny,
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)
Table1:
LOAD *
FROM [$(vFolder)\$(File).qvd] (qvd);
NEXT
Sunny,
It is not working:
LET vFilelist = peek('DateKey'); //I'm readin this from another table. This has the dynamic list of file names
SET vFolder = '\\Folder\';
FOR EACH File in $(vFilelist)
Table1:
LOAD *
FROM [$(vFolder)\$(File).qvd] (qvd);
NEXT
The file names are not getting read by the script in the for loop
Is this a list or a single date?