split two columns into multiple columns

Highlighted
Five Stars

split two columns into multiple columns

Hi,

Could you please tell how to split two columns into multiple   following scenario?

Consider a sample input file as below:

Id, String1,String2,String3,Date1,Date2,Date3

 

Expected Output:

Id,String1,Date1

Id,String2,Date2

Id,String3,Date3

 

 

--------------------------------------------------------------- 

I have tried concatenating all String columns -String1@String2@String3 into one column and used that column to normalize using tNormalize component. 

(But it is not what I expect)

Id,String1,Date1,Date2,Date3

Id,String2,Date1,Date2,Date3

Id,String3,Date1,Date2,Date3


Accepted Solutions
Highlighted
Eight Stars

Re: split two columns into multiple columns

Probably not the most efficient solution, but gets the job done as long as the positions for every element remains consistent in your input set. You wouldn't even need the last tJavaRow if you want your output as one column. 

1.png2.png3.png4.png5.png

View solution in original post

Highlighted
Nine Stars

Re: split two columns into multiple columns

You can try below.

 

CR.PNGCR1.PNGCR2.PNGCR3.PNG

 

Regards,

Veeru Boppudi

View solution in original post

Highlighted
Sixteen Stars
Sixteen Stars

Re: split two columns into multiple columns

tSplitRow is here for that.
Just 1 component is needed in such a case.

TRF

View solution in original post


All Replies
Highlighted
Nine Stars

Re: split two columns into multiple columns

How many columns you have in source?

is it 7 columns? 

 

Regards,

Veeru Boppudi
Highlighted
Five Stars

Re: split two columns into multiple columns

Yes 7 Columns.

For every ID, 3 records needs to be created.

Example:

1, Veeru, Karthik, Jay, 2018-06-30,2018-04-14,2018-05-01

 

Output:

1, Veeru, 2018-06-30
1, Karthik, 2018-04-14

1,Jay, 2018-05-01

Highlighted
Eight Stars

Re: split two columns into multiple columns

Probably not the most efficient solution, but gets the job done as long as the positions for every element remains consistent in your input set. You wouldn't even need the last tJavaRow if you want your output as one column. 

1.png2.png3.png4.png5.png

View solution in original post

Highlighted
Nine Stars

Re: split two columns into multiple columns

You can try below.

 

CR.PNGCR1.PNGCR2.PNGCR3.PNG

 

Regards,

Veeru Boppudi

View solution in original post

Highlighted
Sixteen Stars
Sixteen Stars

Re: split two columns into multiple columns

tSplitRow is here for that.
Just 1 component is needed in such a case.

TRF

View solution in original post

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