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

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
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.
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
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.
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 GARNER 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

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download