Transpose Function Talend

Four Stars

Transpose Function Talend

Hi,
I'm trying to simulate a transpose function
Here is an example of my input lines and what I pretend to get on output:

Input : 

Name city1 city2 city3 city4 city5 city6 city7 city8 city9 

Output : 

Name city1 city2 city3 

Name city4 city5 city6 

Name city7 city8 city9 

 I'm using tmysqlinput for the input but i can use also tFileInputExcel

and i'm using tMysqlOutput fot the output 

Thanks in advance.


Accepted Solutions
Sixteen Stars

Re: Transpose Function Talend

Yes, that is exactly what I was suggesting. If you take a look at the tutorial I posted, you will see how to multiply the rows and get the row multiplication number back. After that it is just a case of using the row number to send the column data to the right output column.

 

 

Nine Stars

Re: Transpose Function Talend

Hi,

 

If you still looking for solution please try below.

 

ColumnsRows1.PNGColumnsRows2.PNGColumnsRows3.PNG

 

Regards,

Veeru Boppudi

All Replies
Sixteen Stars

Re: Transpose Function Talend

This can be done, but can you explain exactly what you want. Do you have 10 columns coming in....

Name, city1, city2, city3, city4, city5, city6, city7, city8, city9 

....and are these fixed? Will there always be 10? Also, are you wanting to output the "Name" column 3 times and always grouping the fields....

Name, city1, city2, city3 
Name, city4, city5, city6
Name, city7, city8, city9 

If so, you need to multiply each row that comes in by 3 and then on row 1 of the 3 create the first row above, on row 2 of the 3 create the second row from above and on row 3 of teh 3 create the last row.

I have created a tutorial on row multiplication here: https://www.rilhia.com/quicktips/quick-tip-row-multiplication

 

All you need to do after that is filter by the row number to identify which values to pass on. Hint: you can use the tMap variables for this.

Four Stars

Re: Transpose Function Talend

Thanks  for replying 

 

yes i will always have the same number of column 10 but the problem is that each column has a different value 

for exa

mple : 

Name City1     City2      City3            City4          City5        City6        City7        City8      City9 

Toto   Seville   Detroit    Canberra    Hamburg   Antwerp    Madrid      Turin        Paris      Milan 

 

output : 

Toto   Seville   Detroit    Canberra   

Toto  Hamburg   Antwerp    Madrid 

Toto    Turin        Paris      Milan 

 

Actually what i need is to multiply each row that comes in by 3 like you say and to say first line is going to be Name column.position1 columnPosition2 columnPosition3 

secend line  : Name column.position4 columnPosition5 columnPosition6 

Sixteen Stars

Re: Transpose Function Talend

Yes, that is exactly what I was suggesting. If you take a look at the tutorial I posted, you will see how to multiply the rows and get the row multiplication number back. After that it is just a case of using the row number to send the column data to the right output column.

 

 

Nine Stars

Re: Transpose Function Talend

Hi,

 

If you still looking for solution please try below.

 

ColumnsRows1.PNGColumnsRows2.PNGColumnsRows3.PNG

 

Regards,

Veeru Boppudi