Qlik Community

QlikView Scripting

Discussion Board for collaboration on QlikView Scripting.

Announcements

Breathe easy -- you now have more time to plan your next steps with Qlik!
QlikView 11.2 Extended Support is now valid through December 31, 2020. Click here for more information.

manojkulkarni
Not applicable

Store QVD data into CSV

Hi,

I need to store data from QVD into CSV. Using below query i could able to generate csv file, but how to split the file into multiple when we reach the row limit in CSV or in excel or in any format.

If anybody has worked or have solution, let me know. It will be great help...

4 Replies
vardhancse
Not applicable

Re: Store QVD data into CSV

Hi,

In general excel will have some limited number of rows, and so I dont think so if QVD having more number of records can export in CSV.

datanibbler
Not applicable

Re: Store QVD data into CSV

Hi,

well, if you know the limit of the target_format you can just include a row_counter in the table and if the limit is reached, some routine has to be called to split the table. The only difficulty is avoiding a giant synthetic key when you split the table into several.

HTH

tresesco
Not applicable

Re: Store QVD data into CSV

Try like:

tablename1:

First 10000 Load * from <qvd>;

Store tablename1 <tablename1>(txt,delimiter is ';')         // or use where clause like shown below

tablename2:

Load * from <qvd> where recno()>10000;

Store tablename2 <tablename2>(txt,delimiter is ';')

marcus_sommer
Not applicable

Re: Store QVD data into CSV

If you want to split the qvd you will need a load-loop over the qvd then the store-command itself had no option for limiting the store in any kind. The follwing routine isn't tested and might need some small syntax- and logical adjustments but in general the logic should work:

let vQVDFile = 'D:\Folder\File.qvd';

let vQVDRecordsTotal = QvdNoOfRecords( '$(vQVDFile)' );

let vQVDRecords = 65532;

let vLoadCounter = 0;

for i = 1 to vQVDRecordsTotal step vQVDRecords

     csvFile:

     Load * From $(vQVDFile) (qvd) where recno() >= $(i) and recno() < $(i) + vQVDRecords;

     let vLoadCounter = $(vLoadCounter) + 1

     store csvFile into csvFile_$(vLoadCounter).csv (txt);

     drop table csvFile;

next

- Marcus