Skip to main content
Announcements
Accelerate Your Success: Fuel your data and AI journey with the right services, delivered by our experts. Learn More
cancel
Showing results for 
Search instead for 
Did you mean: 
zalibra
Contributor III
Contributor III

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

 

 

 

Labels (2)
1 Solution

Accepted Solutions
TRF
Champion II
Champion II

What if you replace tLogRow by tFileOutputDelimited?

View solution in original post

7 Replies
TRF
Champion II
Champion II

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
zalibra
Contributor III
Contributor III
Author

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). 


tMap mapping.jpg
TRF
Champion II
Champion II

What if you replace tLogRow by tFileOutputDelimited?
zalibra
Contributor III
Contributor III
Author

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

zalibra
Contributor III
Contributor III
Author

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

 

zalibra
Contributor III
Contributor III
Author

Got it! Removed one "\" from tMap. 

TRF
Champion II
Champion II

Great! Sorry for the mistake.