Combine columns together, not concatenate

Six Stars

Combine columns together, not concatenate

Hi all,

Trying to combine 2 columns in 1, i.e. trying to put column B values in separate rows (not trying to concatenate. I can concatenate using tMap = row1.xxx+row2.xxx). Below is an example of what I'm looking to do:

 

Original file:

Column A     |     Column B

Seattle          |     Portland

Los Angeles |     Sacramento 

 

Desired output:

Column A

Seattle

Los Angeles

Portland

Sacramento

 

 

 


Accepted Solutions
Fifteen Stars TRF
Fifteen Stars

Re: Combine columns together, not concatenate

What if you replace tLogRow by tFileOutputDelimited?

TRF

All Replies
Fifteen Stars TRF
Fifteen Stars

Re: Combine columns together, not concatenate

If the order for the result doesn't matter and the output is a file, using tMap you can do:
row1.colA + "\\n" + row1.colB
The result will be:
Seattle
Portland
Los Angeles
Sacramento

TRF
Six Stars

Re: Combine columns together, not concatenate

Hi TRF,

 

Thank you for getting back! Tried it, but still concatenating the result for me. tLogRow output is:

Seattle\nPortland

Los Angeles\nSacramento.

 

Screenshots attached. (The order does not matter). 

Fifteen Stars TRF
Fifteen Stars

Re: Combine columns together, not concatenate

What if you replace tLogRow by tFileOutputDelimited?

TRF
Six Stars

Re: Combine columns together, not concatenate

Ah, "and the output is a file"! Let me try that. 

Six Stars

Re: Combine columns together, not concatenate

Just tried tFileOutputDelimited -- same result as tLogRow. Still concatenating with \n. 

 

Created new tFileInputDelimited with Row Separator "\n" and Field Separator ",".

tMap still same as the screenshot. 

tFileOutputDelimited same values: row 1 = Seattle\nPortland, row 2 = Los Angeles\nSacramento

 

Six Stars

Re: Combine columns together, not concatenate

Got it! Removed one "\" from tMap. 

Fifteen Stars TRF
Fifteen Stars

Re: Combine columns together, not concatenate

Great! Sorry for the mistake.

TRF

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Definitive Guide to Data Quality

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

Download

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch

Downloads and Trials

Test drive Talend's enterprise products.

Downloads