Skip to main content
Announcements
See what Drew Clarke has to say about the Qlik Talend Cloud launch! READ THE BLOG
cancel
Showing results for 
Search instead for 
Did you mean: 
premv258
Contributor
Contributor

Split a input file into multiple output files and restict the row count in output file

Hi,

I have an input file with some values and I want to make first filter the data files using distinct value and then each outout file should not contain more than 3 rows. Other than 3rd row shouldgo in to next file.

eg -

Input file

No ID Rank Name
5 103 t5 Ajit
2 102 t2 Rahul
3 102 t3 Santan
4 102 t4 Prem
6 103 t6 Sneha
7 104 t7 Vaishali
8 104 t8 Anup
9 104 t9 Sumit
10 104 t10 Faruk
11 104 t11 Suman
1 102 t1 Varsa

Now based on ID I need n different files based on distinct values in ID column and also if if there are more than 3 same id then rest should go in to other file. Output sample Shown below.

For the input file i should get 5 different output file like....

 

A.txt

S_No|ID|Rank|Name
2|102|t2|Rahul
3|102|t3|Santan
4|102|t4|Prem
B.txt

S_No|ID|Rank|Name
1|102|t1|Varsa
C.txt

S_No|ID|Rank|Name
5|103|t5|Ajit
6|103|t6|Sneha

D.txt

S_No|ID|Rank|Name
7|104|t7|Vaishali
8|104|t8|Anup
9|104|t9|Sumit
E.txt

S_No|ID|Rank|Name
10|104|t10|Faruk
11|104|t11|Suman

and so on...

Any suggestion for this would be vey helpful.

Labels (3)
1 Reply
David_Beaty
Creator III
Creator III

Hi,

 

In the tOutputFileDelimited component, Advanced Settings, theres an option "Split output into several files", tick that and enter the number of rows you want per file.

 

Thanks

 

David

 

Don't forget to give Kudos when the answer is helpful.