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

Announcements
Qlik Connect 2026 Agenda Now Available: Explore Sessions
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] how can i add many bigdecimal ?

i have to do this operation but it returns exception error .  
row13.montant.subtract(row20.montant.add(row21.montant).add(row18.montant).add(row17.montant).add(row3.position)  
please how can i resolve this problem?  
Thank you
Labels (2)
13 Replies
Anonymous
Not applicable
Author

Hi Emy,
What error you are getting? is it null pointer? Check the post
https://community.talend.com/t5/Design-and-Development/resolved-Adding-expressions-to-tMap-component...
Vaibhav
_AnonymousUser
Specialist III
Specialist III

But i have to sum many values of bigdecimal so more than two values . Ho can i calculate it please
Anonymous
Not applicable
Author

tAggregateRow will sum them for you.
Anonymous
Not applicable
Author

Hi emy,
Could you please give us more info about your current job situation. What's your job requirment?
Best regards
Sabrina
Anonymous
Not applicable
Author

row13.montant.subtract(row20.montant.add(row21.montant).add(row18.montant).add(row17.montant).add(row3.position))
I think you missed last close bracket... check again

Vaibhav
_AnonymousUser
Specialist III
Specialist III

Yes of course , 
I'm going to show you my job to understand what i mean :
and this is the SQL request :
Ecart = ( Montant4 - ( Position3 + Montant22 + Montant21 + Montant20 + Montant19 + Montant18 ))
and this is it on Talend : 
Ecart= row4.Montant.subtract(row3.Position.add(row22.Montant).add(row21.Montant).add(row20.Montant).add(row19.Montant).add(row18.Montant))
But it returns this error : 
Exception in component tMap_1
java.lang.NullPointerException
at java.math.BigDecimal.add(Unknown Source)
at myfirstproject.glob2_0_1.glob2.tMysqlInput_1Process(glob2.java:3288)
at myfirstproject.glob2_0_1.glob2.runJobInTOS(glob2.java:18077)
at myfirstproject.glob2_0_1.glob2.main(glob2.java:17942)
i know how to sum 2 bigdecimal but in this case what can i do i have to sum 6 bigdecimal and substract them . 
Thanks for ur answer please help me
_AnonymousUser
Specialist III
Specialist III

Yes of course , 
I'm going to show you my job to understand what i mean :

and this is the SQL request :
Ecart = ( Montant4 - ( Position3 + Montant22 + Montant21 + Montant20 + Montant19 + Montant18 ))
and this is it on Talend : 
Ecart=row4.Montant.subtract(row3.Position.add(row22.Montant).add(row21.Montant).add(row20.Montant).add(row19.Montant).add(row18.Montant))
But it returns this error : 
Exception in component tMap_1
java.lang.NullPointerException
at java.math.BigDecimal.add(Unknown Source)
at myfirstproject.glob2_0_1.glob2.tMysqlInput_1Process(glob2.java:3288)
at myfirstproject.glob2_0_1.glob2.runJobInTOS(glob2.java:18077)
at myfirstproject.glob2_0_1.glob2.main(glob2.java:17942)
i know how to sum 2 bigdecimal but in this case what can i do i have to sum 6 bigdecimal and substract them . 
Thanks for ur answer please help me
Anonymous
Not applicable
Author

Hi Emy,
You have null pointer exception... it means some of your column contains null value...
You will have to handle null for each column like - check the post - http://www.talendforge.org/forum/viewtopic.php?id=7782
row2.Price2==null?row1.Price1:row1.Price1.add(row2.Price2)
This is going to be a two to three line code if you do it in single tMap... but if you prefer, you can use tJavaRow to make it more simple and add it column wise..
Vaibhav
Anonymous
Not applicable
Author

hi all,
my question is "is it normal that you have null value" ?
manage null value is a tecnical issue but what's your business rule when application 's encountering null value espacially when you're doing calculation ? 
how many null value do you have from sources ? 0683p000009MA9p.png
Could it be null ?
regards
laurent