Skip to main content
Announcements
Qlik Connect 2024! Seize endless possibilities! LEARN MORE
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Splitting files

Hi Experts,

I have a pivot table with 8764 lines of records.

I need to split into sub files with 900 lines of records each.

Is it possible?

pls give suggestions

1 Solution

Accepted Solutions
jagan
Luminary Alumni
Luminary Alumni

Hi Rajendran,

Check below script, it is working

Data:

LOAD

RowNo() AS RowNum,

*

FROM DataSource;

LET vRowsPerFile = 900;

LET vRowCount =NoOfRows('Data');

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;

DROP TABLE Temp;

LET vRowStartNum = vRowEndNum + 1;

NEXT Index;

View solution in original post

21 Replies
Not applicable
Author

You can do. What is the purpose of spiting the files ?

In Qlikview 8764 rows is not a bad.

Not applicable
Author

hi dathu,

the requirement is like that.

Each file should have only 900 lines and the file has to be sent thro NPrinting.

pls help me to do this

Anonymous
Not applicable
Author

hi,

Please try to use filters in calculated dimension or expressions to split records as per your requirement.

Regards

Neetha

Not applicable
Author

is it possible in the script?

i cant use calculated dimensions.

i need to split from the table

Anonymous
Not applicable
Author

Not applicable
Author

thanks for the response.

but give some suggestions to do in script itself.

is it possible to split one table to several tables with 900 lines.

i.e., my table has 8764 lines, then i need to split into 10 files.

is it possible?

by using filter like rowno?

pls help

Not applicable
Author

Do you have only one table in your data model ?

Is pivot table creating from one table fields ?

Add the Newfield to your dimension table have 8374 records called Bucket with below expression:

Ceil(RowNo()/900) AS Bucket.

So Bucket have 1 , 2 3, etc for each 900 rows in the table. So you can simply create your own no of Pivvot tables based on that.

jagan
Luminary Alumni
Luminary Alumni

Hi,

In script try like this

Data:

LOAD

RowNo() AS RowNum,

*

FROM DataSource;

LET vRowCount =NoOfRows('Data');

LET vNoOfPages = Ceil(vRowCount)/900;

LET vRowStartNum = 1;

For Index = 1 to vNoOfPages

LET vRowEndNum = vNoOfPages * Index;

Temp:

NoConcatenate

LOAD

*

RESIDENT Data

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


STORE Temp INTO File$(Index).qvd;

DROP TABLE Temp;

LET vRowStartNum = vRowStartNum  + vRowEndNum ;

NEXT Index;


After executing this script, a separate QVD is created for every 900 rows in your data.

Hope this helps you.

Regards,

Jagan.

Anonymous
Not applicable
Author

hi,

instead of splitting data for 900 records each ,split by months or years and store in qvds.

this way maintenance wise its easier.

Regards

Neetha