Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
shahafei2
Creator
Creator

split QVD to CSVs

Hi,

I have a huge QVD file that I would like to split equally between X CSV files

Any idea how can I do it if the amount of records doesn't know?

 

1 Solution

Accepted Solutions
Taoufiq_Zarra

@shahafei2  if you have a rowno() or keyID in you datasource you can use the script below, if not you have to add it in your qvd file before the script like ;

Data:

LOAD

RowNo() AS RowNum,

*

FROM DataSource;

to know the no of records in your QVD you can use QvdNoOfRecords ('Data.qvd')

suppose you want to plit the qvd to 10 csv file,the scipt :

LET vRowsPerFile = QvdNoOfRecords ('Data.qvd')/10;

LET vRowCount =QvdNoOfRecords ('Data.qvd');

LET vNoOfPages = Ceil(vRowCount/vRowsPerFile);

LET vRowStartNum = 1;

For Index = 1 to vNoOfPages

LET vRowEndNum = vRowsPerFile * Index;

Temp:

NoConcatenate

LOAD

*

RESIDENT Data

WHERE RowNum >= $(vRowStartNum) AND RowNum <=$(vRowEndNum);

STORE Temp INTO File$(Index).qvd;
Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉

View solution in original post

3 Replies
Taoufiq_Zarra

@shahafei2  if you have a rowno() or keyID in you datasource you can use the script below, if not you have to add it in your qvd file before the script like ;

Data:

LOAD

RowNo() AS RowNum,

*

FROM DataSource;

to know the no of records in your QVD you can use QvdNoOfRecords ('Data.qvd')

suppose you want to plit the qvd to 10 csv file,the scipt :

LET vRowsPerFile = QvdNoOfRecords ('Data.qvd')/10;

LET vRowCount =QvdNoOfRecords ('Data.qvd');

LET vNoOfPages = Ceil(vRowCount/vRowsPerFile);

LET vRowStartNum = 1;

For Index = 1 to vNoOfPages

LET vRowEndNum = vRowsPerFile * Index;

Temp:

NoConcatenate

LOAD

*

RESIDENT Data

WHERE RowNum >= $(vRowStartNum) AND RowNum <=$(vRowEndNum);

STORE Temp INTO File$(Index).qvd;
Regards,
Taoufiq ZARRA

"Please LIKE posts and "Accept as Solution" if the provided solution is helpful "

(you can mark up to 3 "solutions") 😉
shahafei2
Creator
Creator
Author

Thanks ill try it 

shahafei2
Creator
Creator
Author

Thanks a lot 

it's worked like a magic