Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik and ServiceNow Partner to Bring Trusted Enterprise Context into AI-Powered Workflows. Learn More!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to combine 2 columns into one?

Hey guys, TOS is amazing. However I'm having a problem combining 2 columns into 1. I've looked into using tMap, but I can't find my solution. I'm inputing from a delimited file if that makes any difference. I have 2 columns:
My input is
ID    | Category1   | Category2
| 1   |    Apparel  |   Jackets |
| 2   |    Shoes    |  Running |
My output that I want to have is
ID     |  Category
| 1    |   Apparel |
| 2    |   Jackets  |
| 3    |   Shoes    |
| 4    |   Running |

Any advice you have, would be great! 
Labels (2)
7 Replies
Anonymous
Not applicable
Author

This is a good exercise to get familiar with the flexibility of Talend. In order to achieve this you will need a tMap and a tNormalize component. 
In the tMap you need to join the Category1 and Category2 columns with a consistent separator. So in your output, you will want something like.....

row1.Category1 ";" row1.Category2

Then join the tMap output to the tNormalize component. The configuration of this component is pretty well explained here.
If you want to update the ID with a continuous sequence of 1 to n, then you can do that with several different components. An easy way is to use another tMap and use a tMap variable to count the rows. Use that counter in your output. 
_AnonymousUser
Specialist III
Specialist III

Hi,
You need to use tSplitRow which is dedicated to split 1 rows in 2 or more.
Really simple to use with just one step.
Regards,
Fred
Anonymous
Not applicable
Author

I forgot about the tSplitRow to be honest. I am usually dealing with data that is stored comma separated that needs to be split into different rows. 
Anonymous
Not applicable
Author

 

I want to combine of two column into one but it is an interger value. I want to combine it without using tSplitRow.

 

thanks,

Kanda

Anonymous
Not applicable
Author

Hi ,

 

We can combine two columns by providing comma and concatenating in TMap and then normalizing the output based on comma.

I have provided mapping and other photos.


tmapone.PNG
combine_two_columns.PNG
Anonymous
Not applicable
Author

Hi,

  thank you so much much aaryan for helping me

Anonymous
Not applicable
Author

Hi,

 

Can you please provide the step by step configuration of each component to achieve this result. I am new to Talend, I want to know. Thanks in advance!