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

Announcements
Join us in Toronto Sept 9th for Qlik's AI Reality Tour! Register Now
cancel
Showing results for 
Search instead for 
Did you mean: 
alexis
Partner - Specialist
Partner - Specialist

One QlikView data file = multiple QVDs

Hi all,

In the attached QVW you will see just a single table (XX)

One of the fields in that table is called QVDFilename which I have constructed from other fields and it signifies (as the name implies) the QVD file that the particular row should be written to. This file has a total of 8 different QVD files

Can anyone thing of any way of creating these QVDs?

I have been racking my brain and cannot find a way.

Thanks in advance

Alexis

*** File not empty now - Thanks Rob ****

1 Solution

Accepted Solutions
Not applicable

If all your data is contained in one table and you want to write different parts of the table to a different file:

//Script

[Data Table];

//create a string with all the file names:

QVDFileNames:

Load chr(39) & concat(distinct QVDFilename, chr(39) & ',' & chr(39)) & chr(39) as QVDFileNames

Resident [Data Table];

//put them in a var

LET vQVDFileName = Peek('QVDFileNames', 0, 'QVDFileNames');

//drop the table with file names

drop table QVDFileNames;

//Create a loop

FOR Each vQVDFileName in $(vQVDFileName)

//Filter out the table:

QVDToStore:

NoConcatenate

LOAD * Resident [Data Table] where QVDFileName = '$(vQVDFileName)';

//Store the sub-table into QVD

STORE QVDToStore into '$(vQVDFileName)'.qvd (QVD);

//Drop the sub table

DROP Table QVDToStore;

//next vQVDFileName

NEXT

//drop the original table

DROP TABLE [Data Table];

Is this what you're looking for?

View solution in original post

8 Replies
rwunderlich
Partner Ambassador/MVP
Partner Ambassador/MVP

The qvw you posted is empty.

alexis
Partner - Specialist
Partner - Specialist
Author

Thanks Rob - reloaded - try now!

Not applicable

If all your data is contained in one table and you want to write different parts of the table to a different file:

//Script

[Data Table];

//create a string with all the file names:

QVDFileNames:

Load chr(39) & concat(distinct QVDFilename, chr(39) & ',' & chr(39)) & chr(39) as QVDFileNames

Resident [Data Table];

//put them in a var

LET vQVDFileName = Peek('QVDFileNames', 0, 'QVDFileNames');

//drop the table with file names

drop table QVDFileNames;

//Create a loop

FOR Each vQVDFileName in $(vQVDFileName)

//Filter out the table:

QVDToStore:

NoConcatenate

LOAD * Resident [Data Table] where QVDFileName = '$(vQVDFileName)';

//Store the sub-table into QVD

STORE QVDToStore into '$(vQVDFileName)'.qvd (QVD);

//Drop the sub table

DROP Table QVDToStore;

//next vQVDFileName

NEXT

//drop the original table

DROP TABLE [Data Table];

Is this what you're looking for?

Not applicable

Attached.

alexis
Partner - Specialist
Partner - Specialist
Author

On paper that is precisely what I want - let me try on my original application and revert.

I'm very optimistic 🙂

Thanks again

Alexis

alexis
Partner - Specialist
Partner - Specialist
Author

Clay that was PERFECT.

Exactly what I was after - thank you very much..

Alexis

Not applicable

It might need some slight tweaking, especially around the store-statement, but it should work. Let me know.

C  ;o)

Not applicable

No worries.

C  ;o)