Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi,
I have written a piece of code to loop through all the files in a network path and save the file names into a qvd. The script is like this
For wach File in FileList($(DirPath))
Load
FileName($(File)) as FileName,
Today() as FileLoadedOn
Autogenerate 1;
Next File;
$(DirPath) has "\\server-01\folder1\File_*.qvd" to get all the qvd files starting with File_.
When this code is executed, i am getting the error saying "Field not found - <\\server>
How to resolve this error ?
Don't add any arguments to FileName(). Just FileName() as Filename. But that only works if you actually load from a file. You don't use a FROM clause so you're only generating a single record. You can't use FileName() in that case.
For each File in FileList($(DirPath))
Load
'$(File)' as FileName,
Today() as FileLoadedOn
Autogenerate 1;
Next File;
If you actually want to load the data from the files then use something like this:
For wach File in FileList($(DirPath))
Load
*
FileName() as FileName,
Today() as FileLoadedOn
FROM
[$(File)] (...whatever is appropriate here...)
;
Next
Thanks Gysbert, that resolved the error. But the FileName column in table is showing as null. Am i missing anything ?
Deepika