One Star

concatenate 2 or more columns with a null value

I can't find how to concatenate 2 or more columns with a null value.
for example:
col1 col2 col3
one two (empty)
one (empty) (emplty)

i tried col1+" "col2+" "+ col3 in tmap and it gave me "one two null". I just want "one two" without a null. How can i accomplish this.
Thanks
1 REPLY
Community Manager

Re: concatenate 2 or more columns with a null value

Hello
You need covert null to "" first, add another tMap to do this.eg:
tFileInputDelimited-row1-tMap--tMap-row2--tLogRow
On the first tMap, convert null to "" like this:
on the expression of col3 column, type in
row1.col3==null?"":row1.col3
on the second tMap, concatenate columns:
row2.col1+" "+row2.col2+" "+row2.col3
Best regards
shong
----------------------------------------------------------
Talend | Data Agility for Modern Business