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

transpose a file: invert rows in columns

Highlighted
Six Stars
Six Stars

transpose a file: invert rows in columns

Here is the structure of the file :
id|country_code|Country_name
1,2,3|cm,fr,us|Cameroon,France,United States

We want to transform it to something like :
id|country_code|Country_name
1|cm|Cameroon
2|fr|France
3|us|United States

 

That's just a sample, the file we have is 6000 items


Accepted Solutions
Highlighted
Six Stars
Six Stars

Re: transpose a file: invert rows in columns

Here is how I handle the issue :

job-talend.JPG

I use tJavaFlex to split each rowtjavaflex.JPGThat the data generated trowgenerator.JPG

View solution in original post


All Replies
Highlighted
Six Stars
Six Stars

Re: transpose a file: invert rows in columns

Here is how I handle the issue :

job-talend.JPG

I use tJavaFlex to split each rowtjavaflex.JPGThat the data generated trowgenerator.JPG

View solution in original post

Highlighted
Four Stars

Re: transpose a file: invert rows in columns

you can achieve this with help of tnormalizerow and numeric sequence routine.

using tnormalizerow and sequence routine  you will have to generate following 

id seq  country code seq      country_name seq

1  1       cm                  1         cameroon        1

2  2       fr                     2         france              2

3  3        fr                     3         united states   3

 

after this you can perform join operation on seq column 

and you will get

 id|country_code|Country_name
1|cm|Cameroon
2|fr|France
3|us|United States

 

This is applicable for n number of records

    

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