Qlik Community

Qlik Sense App Development

Discussion board where members can learn more about Qlik Sense App Development and Usage.

Announcements
Announcing the newest addition to the Qlik Community, Qlik Gallery! Learn More
anders_uddenber
New Contributor III

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
Employee
Employee

Re: FileName() is empty, why?

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);

anders_uddenber
New Contributor III

Re: FileName() is empty, why?

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
Valued Contributor II

Re: FileName() is empty, why?

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.

Partner
Partner

Re: FileName() is empty, why?

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
Contributor III

Re: FileName() is empty, why?

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

Thanks for your time,

Michalina

Partner
Partner

Re: FileName() is empty, why?

Should be fixed in the June release of Sense.

due soon

kuczynska
Contributor III

Re: FileName() is empty, why?

Thanks, I was hoping you will say that

regards

Partner
Partner

Re: FileName() is empty, why?

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.