string and Big Decimal concatenate

One Star

string and Big Decimal concatenate

Hi,
row1.c1 -> String
row1.c2 -> String
row1.c3 -> Big Decimal
row1.c4 -> Big Decimal
Please explain to CONCATENATE in tmap.
In Oracle
count(DISTINCT(row1.c1||row1.c2||row1.c3||row1.c4))
Regards
Murali R
Moderator

Re: string and Big Decimal concatenate

Hi skr150378,
Could you please elaborate your use case with an example with input and expected output values? Do you want to turn all your rows into one? Such as,
A;
B;
13.56;
34.24;
A;B;13.56;34.24?

Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: string and Big Decimal concatenate

Hi,
Thank for replay.
Yes. A;B;13.56;34.24

Regards
Murali R
Sixteen Stars

Re: string and Big Decimal concatenate

Using the example you gave and the expected output, this is how I would do it.....
Put the following in the value expression of the output column or put this in a tMap variable and connect the variable to the output column.

row1.c1+";"+row1.c2+";"+row1.c3.toString()+";"+row1.c4.toString()


However, you should understand that if any of those columns hold NULL, you will get issues. The String columns will just return "NULL" in the concatenated String. That might not be too bad. But the BigDecimals will throw an error. So if you can guarantee that there will be no nulls, then the above is the way to do it simply. If the BigDecimals might be null, you can do the following....
row1.c1+";"+row1.c2+";"+(row1.c3!=null ? row1.c3.toString() : "NULL")+";"+(row1.c4!=null ? row1.c4.toString() : "NULL")

This will result in A;B;13.56;34.24 if all columns have values or  A;NULL;13.56;NULL if c2 and c4 are NULL.