How to combine 2 columns into one?

One Star

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! 
Highlighted
Community Manager

Re: How to combine 2 columns into one?

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. 
One Star

Re: How to combine 2 columns into one?

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
Community Manager

Re: How to combine 2 columns into one?

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. 
Four Stars

Re: How to combine 2 columns into one?

 

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

Six Stars

Re: How to combine 2 columns into one?

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.

Four Stars

Re: How to combine 2 columns into one?

Hi,

  thank you so much much aaryan for helping me

Cloud Free Trial

Try Talend Cloud free for 30 days.

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.