From Thursday, July, 9, 3:00 PM Pacific,
our Community site will be in
read-only mode
through Sunday, July 12th.
Thank you for your patience.

How to split one row into multiples rows?

Highlighted
One Star

How to split one row into multiples rows?

I have the following input:
Row1: Name1, FirstName1, Charge1, Charge2, Charge3, Charge4
Row2: Name2, FirstName2, Charge1, Charge2, Charge3
and I would like the following output:
Row1: Name1, FirstName1, Charge1
Row2: Name1, FirstName1, Charge2
Row3: Name1, FirstName1, Charge3
Row4: Name1, FirstName1, Charge4
Row5: Name2, FirstName2, Charge1
Row6: Name2, FirstName2, Charge2
Row7: Name2, FirstName2, Charge3
It looks like I would have to use the Tnormalize function, but I am not able to get the result expected.
Thanks for your help
Highlighted
Community Manager

Re: How to split one row into multiples rows?

Hello
Before you use the tNormalize, you need to concact the normalize columns with another symbol. Here is a simple scenario:
in.csv:

Name1,FirstName1,Charge1,Charge2,Charge3,Charge4
Name2,FirstName2,Charge1,Charge2,Charge3

tJavaRow_1:
output_row.name = input_row.name;
output_row.firstName = input_row.firstName;
output_row.conn = input_row.c1+"@"+input_row.c2+"@"+input_row.c3+"@"+input_row.c4;

Result:
tarting job forum6611 at 14:30 15/05/2009.
.-----+----------+-------.
| tLogRow_1 |
|=----+----------+------=|
|name |firstName |conn |
|=----+----------+------=|
|Name1|FirstName1|Charge1|
|Name1|FirstName1|Charge2|
|Name1|FirstName1|Charge3|
|Name1|FirstName1|Charge4|
|Name2|FirstName2|Charge1|
|Name2|FirstName2|Charge2|
|Name2|FirstName2|Charge3|
'-----+----------+-------'
Job forum6611 ended at 14:30 15/05/2009.

Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
Highlighted
One Star

Re: How to split one row into multiples rows?

Thanks a lot! Exactly what I needed.
Highlighted
One Star

Re: How to split one row into multiples rows?

This has helped me as well. Thanks shong
Highlighted
One Star

Re: How to split one row into multiples rows?

SOURCE:


ID
58
MEMNO
369&370
NAME
Rohit Sharma/Bhupender K
DATE
8 Dec 2014/16 Jan 2014

Target: should be
ID  MAMNO,NAME,DATE
58,369,rohitsharma,8 DEC 2014
59,370,Bhupender K,16 Jan 2014

how can we achieve this by using talend,please any body help me
Highlighted
One Star

Re: How to split one row into multiples rows?

ID
58
MEMNO
369&370
NAME
Rohit Sharma/Bhupender K
DATE
8 Dec 2014/16 Jan 2014

Target: should be
ID  MAMNO,NAME,DATE
58,369,rohitsharma,8 DEC 2014
59,370,Bhupender K,16 Jan 2014

how can we achieve using talend and mysql
Highlighted
Moderator

Re: How to split one row into multiples rows?

Hi manjunath.m,
Please take a look at tExtractRegexFields or tExtractDelimitedFields components.
https://help.talend.com/search/all?query=tExtractRegexFields&content-lang=en
https://help.talend.com/search/all?query=tExtractDelimitedFields&content-lang=en
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.

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

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog