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

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] Error The operator + is undefined for the argument type(s) java.math.B

Hi,
I need to do sum multiple column in tMap which is the data type is big Decimal.
On tmap, i set the expression as below 
row1.valueA+row1.valueB+row1.valueC+row1.valueD+row1.valueE+row1.valueF+row1.valueG+row1.valueH
Please advice the best way how to do multiple summation in talend.
Labels (2)
1 Solution

Accepted Solutions
JR1
Creator III
Creator III

Hi
Simple operators like "+" or "-" do not work for the Java data type BigDecimal. You will have to use the "add" method of the BigDecimal class. To add two BigDecimals this will look like this: 
row1.valueA.add(row1.valueB)

If you want to add more than two values, you will need to nest the calls:
row1.valueD.add(row1.valueC.add(row1.valueB.add(row1.valueA)))

The result will be a BigDecimal.

View solution in original post

2 Replies
JR1
Creator III
Creator III

Hi
Simple operators like "+" or "-" do not work for the Java data type BigDecimal. You will have to use the "add" method of the BigDecimal class. To add two BigDecimals this will look like this: 
row1.valueA.add(row1.valueB)

If you want to add more than two values, you will need to nest the calls:
row1.valueD.add(row1.valueC.add(row1.valueB.add(row1.valueA)))

The result will be a BigDecimal.
Anonymous
Not applicable
Author

Thank you. It work very well...