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

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

6 Ways to Start Utilizing Machine Learning with Amazon We Services and Talend

Look at6 ways to start utilizing Machine Learning with Amazon We Services and Talend

Blog