Qlik Community

New to QlikView

Discussion board where members can get started with QlikView.

cxclucas
New Contributor III

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

Tags (1)
2 Replies
Highlighted
MVP & Luminary
MVP & Luminary

Re: Get File Name and Store using it

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

MVP
MVP

Re: Get File Name and Store using it

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.