Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
See why IDC MarketScape names Qlik a 2025 Leader! Read more
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

Convert String to BigDecimal in tMapJoin

Hi, in my tMap I'm joining two tables, but I've discovered that the join fields are one a String and one a BigDecimal. The output must be a String. I used the method "toString()" on the BigDecimal field, but it keeps telling me that it cannot convert from String to BigDecimal, which I don't understand since I'm doing the opposite operation.

Labels (2)
4 Replies
manodwhb
Champion II
Champion II

@Mary,can you provide sample date which are you going to String to BigDecimal? I believe there could be data issue.

iamabhishek
Creator III
Creator III

Try something like this - 

String.valueOf((row1.bigDecimalField).doubleValue())
Jesperrekuh
Specialist
Specialist

could you provide a tMap screenshot please?

- And why to String??? 
- And if your output is towards a table and its "Create if not exists" setting , when you altered your tMap there's still a problem your table still is BigDecimal ...

 

However.... an important sidenote :

 

BigDecimal bgd = new BigDecimal(8.0001)
System.out.println(bgd.toString());
// the output could be : 8.0000999999999998765981265985983427124042342

It will get the closest value So your join goes wrong, instead of the above code, this should be used: 

 

 

BigDecimal bgd = new BigDecimal.valueOf(8.0001)

I hope Talend conversion works in this way...

 

 

 

 

manodwhb
Champion II
Champion II