Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
dattasud
Contributor III
Contributor III

How to convert one column values to multiple columns in talend?

Hi All,

 

I have a input data like this:

Title	Value
A	5
B	4
C	7
D	10
E	8

And how can I convert my Title column values to multiple column and tag the value to it?

Desired output:

A	B	C	D	E
5	4	7	10	8

I tried tDenormalize but got same output like my input, since all title values are unique already to denormalize.

 

I tried tMap to transform my data, but got like this below:

A	B	C	D	E
5	5	5	5	5
4	4	4	4	4
7	7	7	7	7
10	10	10	10	10
8	8	8	8	8

Please help.

Labels (2)
1 Solution

Accepted Solutions
dattasud
Contributor III
Contributor III
Author

I solved this problem by writing custom code using tJavaFlex. I created my desired columns in tJavaFlex (output). Then on main code loop I used if else statement to populate the values based on input rows. I found out that my last row of the tJavaFlex output is accurate with proper values. So, I used tSortrow (created a counter column and incremented it) with desc and used tSampleRow to take the last row.

 

Above is one approach to solve this problem. If anyone finds better and efficient approach, please share.

View solution in original post

1 Reply
dattasud
Contributor III
Contributor III
Author

I solved this problem by writing custom code using tJavaFlex. I created my desired columns in tJavaFlex (output). Then on main code loop I used if else statement to populate the values based on input rows. I found out that my last row of the tJavaFlex output is accurate with proper values. So, I used tSortrow (created a counter column and incremented it) with desc and used tSampleRow to take the last row.

 

Above is one approach to solve this problem. If anyone finds better and efficient approach, please share.