Skip to main content
Announcements
Live today at 11 AM ET. Get your questions about Qlik Connect answered, or just listen in. SIGN UP NOW
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

FileName() is empty, why?

I'm developing an application and need to use FileName(). This function returns nothing and neither does FileBaseName(). FileDir() however returns "lib://QvdLib".

I've found a function called DocumentName() but it returns something like "829askjd89asjk238dshdj29dfjd"

My setup is that I'v developing using Remote Desktop, then via Qlik Sense Hub, and not the Desktop application.

Edit:

// Doesn't work. Filnamn2 is empty

tempQVD:

LOAD

    FileName() as Filnamn2

FROM [lib://QvdLib/rtr_*.qvd] (qvd);

// Works!

tempExcel:

LOAD

    FileName() as Filnamn

FROM [lib://ExcelLib1/Kontouppföljning*.xlsx]

(ooxml, embedded labels, table is Blad1);

8 Replies
JonnyPoole
Employee
Employee

The help says that filename() should return the file name without the extension for table data sources.  This SHOULD include QVD but it doesn't work as you say. It does work for excel table files.

For QVDs I found the following works in place:    QvdTableName('file')  .  See below for an example

LOAD

    CustomerID,

    FileName() as Filename,

   QvdTableName('[lib://Data/Customers.qvd]') as QVDFilename

FROM [lib://Data/Customers.qvd]

(qvd);

Anonymous
Not applicable
Author

Good to hear that I'm not the only one experiencing this issue. Unfortunately, your solution does not cover my use case.

I need to know the file name as I load with '*': "(FROM [lib://QvdLib/rtr_*.qvd] (qvd);". I'm loading several files with names like rtr_1.qvd, rtr_2.qvd and I need to capture the number.

undergrinder
Specialist II
Specialist II

Hi!

There is a good example in "Syntax and Chart function guide", you can customize the following code:

// Example 2 - List all QV related files on disk

sub DoDir (Root)

     For Each Ext in 'qvw', 'qvo', 'qvs', 'qvt', 'qvd', 'qvc', 'qvf'

          For Each File in filelist (Root&'\*.' &Ext)

               LOAD

                    '$(File)' as Name, FileSize( '$(File)' ) as

                    Size, FileTime( '$(File)' ) as FileTime

              autogenerate 1;

          Next File

     Next Ext

For Each Dir in dirlist (Root&'\*' )

Call DoDir (Dir)

Next Dir,

End Sub

Call DoDir ('C:')

HTH

G.

p_verkooijen
Partner - Specialist
Partner - Specialist

Logged a case with Qlik this is the response I received:

This is in reference to your case number - 01099753
Subject: Since 3.2.4 function filename() returns no data
A new comment has been posted related to your case :

Hi Paul.

Thank you for contacting Qlik Support.

If all the files are Excel files, then it is a know bug (bug id QLIK-76421). The bug is already solved internally and most probably will be available in the next service release.

It should work fine with for instance qvd or txt files.

kuczynska
Creator III
Creator III

Hi Paul - do you maybe know if this has been resolved?

Thanks for your time,

Michalina

p_verkooijen
Partner - Specialist
Partner - Specialist

Should be fixed in the June release of Sense.

due soon

kuczynska
Creator III
Creator III

Thanks, I was hoping you will say that

regards

p_verkooijen
Partner - Specialist
Partner - Specialist

And its there Qlik Sense June 2017

Checked the releasenotes and it should be fixed

FileName() function does not work when loading data from Excel

Jira issue ID: QLIK-76421

Description: The FileName() function returned null instead of the filename.