Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

michaelk
Contributor

Problem with Filelist

I'm trying to extract some information from a filelist created with the 'for each Datei in filelist' statement.

The table TempFolder is created and the field 'QVDPathName' contains the complete path and the filename

with the extension.

If I try to extract the simple filename with the FileBaseName function, I'm getting only a blank field.

The 'QVDCreateTime' function works properly!

    for each Datei in filelist('$(vPath)' & 'QDatei*.QVD')

        TempFolder:

        Load

            '$(Datei)' as QVDPathName

        Autogenerate 1;

        Folder:

        Load

            FileBaseName(QVDPathName) as QVDName,

            QvdCreateTime(QVDPathName) as QVDDatum

        resident TempFolder;

     next

Any ideas, where the problem is?

Michael

6 Replies
MVP
MVP

Problem with Filelist

Hi Michael,

is FileName() working?

- Ralf

MVP
MVP

Re: Problem with Filelist

Hi

Use FileBaseName without parameters like: FileBaseName()

It returns the base name of the file currently being loaded.

Regards

Jonathan

Highlighted
michaelk
Contributor

Problem with Filelist

Hi Ralf,

no FileName() is also not working. Maybe it is an issue of my installed version. Actually I'm using V10SR3.

I've initiated to update to the latest version.

Michael

michaelk
Contributor

Problem with Filelist

Hi Jonathan,

FileBaseName() without parameters is also not working. Maybe an issue of the version. See my earlier post.

Michael

MVP
MVP

Re: Problem with Filelist

Hi

OK, I see the problem. FileBaseName() only works in a load statement loading from a file (qvd, txt, xls etc) and does not work from a resident load or a database load. You are using it in a resident load and it will not work because it gets the base file name of the file being loaded.

Your best bet is to move the FileBaseName() to the TempFolder load. You can then fetch the basename from the temp folder in the second load

Regards

Jonathan

MVP
MVP

Re: Problem with Filelist

Oh, and change the Autogenerate 1 to From [$(Datei)];

ie:

LOAD FileBaseName() As QVDName

FROM [$(Datei)];