Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Join us in Bucharest on Sept 18th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Get File Name and Store using it

Hi

I would like to STORE using the name from the file source. How can I do it?

Ive tried something like this, but then I noticed I must use the FileName() on the loading section only. How can I solve it?

set File = FileName();

Table1:

LOAD

     A,

     B

FROM

(ooxml, embedded labels, table is Sheet1);

STORE Table1 into $(File).csv(txt);

3 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

Table1:

LOAD

    FileName() as fname,

    A,

    B

FROM

(ooxml, embedded labels, table is Sheet1);

LET vFilename=peek('fname');

DROP FIELD fname;

STORE Table1 into $(vFilename).csv(txt);

-Rob

http://masterssummit.com

http://qlikviewcookbook.com

swuehl
MVP
MVP

I first misunderstood your question that you wanted to know the name of the qvw application, for which you could use

Let vDocumentName = DocumentName();

But I think this is not what you want.

Still, I wonder why you want to query a file name of the source input file if you already know it.

Maybe because you are actually using wildcards?

As an alternative, instead of using wildcards, you can use a FOR EACH with filelist() and use the variable to both read in your data and store to a file using the same base file name.

davyqliks
Specialist
Specialist

Hi There,

I wonder if you can assist.

I am using Filename() as Filename but have found since the outbreak we are having empty files and these are not showing as a filename.

Is there a way to show filename for files imported with only header??

Thank you