Talend Connect
Virtual Summit
JOIN US!
And visit the Customer
& Community Lounge.
May 27-28, wherever you are.

How to split record into several/multiple row depending upon condition

Highlighted
Four Stars

How to split record into several/multiple row depending upon condition

Hi All,
Please let me know how to split record from input source file to several/multiple row in output file depending upon condition defined in the column data.
For example consider the input source file as given below:-
Name|Age|Count
David|35|3
Sam|40|2
Joe|29|1
Peter|21|0
The column named "Count" consist values as 3,2,1,0. So depending upon these values I should get my output data split into several row
The desired output should be :-
Name|Age|Count
David|35|3
David|35|3
David|35|3
Sam|40|2
Sam|40|2
Joe|29|1
Peter|21|0
I have got 3,2,1,0 records for David,Joe & Peter respectively.
Regards
swabhosa
Highlighted
Moderator

Re: How to split record into several/multiple row depending upon condition

Hi,
You can use tLoop component to achieve your goal.
The work flow should be:tfileinputxxx(input)-->tflowtoiterate-->tloop-->tfixedflow-->output
Please see my screenshots for details
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Highlighted
Four Stars

Re: How to split record into several/multiple row depending upon condition

Hi Sabrina,

Thanks for your solution. It helped me. 


But I want output to be inserted into single file. How I can achieve this task??


Regards Swabhosa
Highlighted
Moderator

Re: How to split record into several/multiple row depending upon condition

Hi,
Here is a component TalendHelpCenter:tFileOutputDelimited which is used to output data to a delimited file.
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Highlighted
One Star

Re: How to split record into several/multiple row depending upon condition

Hi Sabrina,
Can you please show what setting you did for tFixedFlowInput_2?
Thanks
Rohan

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog