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

Announcements
Qlik GA: Multivariate Time Series in Qlik Predict: Get Details
cancel
Showing results for 
Search instead for 
Did you mean: 
Flex
Contributor
Contributor

Add column in qvd for different qvd entry

Hi all, I got 6 xlsx at the begining but actually they are all grouped in one table when i load it, but the problem is if I want to use a filtre it can't filter on all my sheets cause it's not the same column used.So, I want to create a column in my QVD, where the information inside depends on wich xlsx is load.

Like my first file xlsx : 1.xlsx have the same value as my 2.xlsx and I want to define a new column who can separate the value of my 1st xlsx and the value of my 2nd xlsx. The colum name is data and take value like 1,2 for the different files i got to load.

If you have any idea, I'm a little short right now.

Thx guys

3 Replies
Chanty4u
MVP
MVP

Try this 

For Each vFile in FileList('C:\Data\*.xlsx') 

    TempTable:

    LOAD *,

        AutoNumber(FileName(), 'FileGroup') AS DataSourceID, 

        FileName() AS SourceFile 

    FROM [$(vFile)]

    (ooxml, embedded labels, table is Sheet1;

 

    STORE TempTable INTO '././CombinedData.qvd' (qvd);

    DROP TABLE TempTable;

Next

rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

You can use the function in your script:

FileBaseName() as data

to create value identifying which xlsx these rows were loaded from. 

-Rob

marcus_sommer

You could simply add something like: '1xlsx' as Source if it are separate load-statements and by using a wildcard loop-load it may: filebasename() as Source.