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
4 REPLIES
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