Skip to main content
Announcements
Qlik Connect 2025: 3 days of full immersion in data, analytics, and AI. May 13-15 | Orlando, FL: Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

FileName from a network path

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>

Capture.JPG

How to resolve this error ?

2 Replies
Gysbert_Wassenaar

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


talk is cheap, supply exceeds demand
Not applicable
Author

Thanks Gysbert, that resolved the error. But the FileName column in table is showing as null. Am i missing anything ?

Deepika