I'm facing null pointer exception in Tmap when I'm doing calculation below you can see in screen shot,
and I already checked in database for same calculation but their are no null values in them how to resolve this error
Thanks in advance
Community all-star, @rhall_2_0, wrote a very nice guide on how to identify which rows are causing errors in a tMap:
If this works for you, throw him some kudos.
If row18.CUST_TOTAL_QUOTA_BEFORE and row18.CUST_TOTAL_QUOTA_USED_BEFORE are both Java Objects of type Double (i.e. they are set as nullable), and are not Java primitive type double, then you should do the expression as follows
( row18.CUST_TOTAL_QUOTA_BEFORE!=null && row18.CUST_TOTAL_QUOTA_USED_BEFORE!=null ? new Double(row18.CUST_TOTAL_QUOTA_BEFORE.doubleValue() - row18.CUST_TOTAL_QUOTA_USED_BEFORE.doubleValue()) : null)
This is an inline if statement. We are checking first that none of the 2 objects are null. Then if both are not null, we do the double substraction, and return a new Double object since your target column is also of type Double. If one or both of the Double objects are null, then we return null. It is up to you to figure out what to do if one of them is null.
If these values can never be null in the database, then you will simplify the logic by unchecking the nullable attribute on the column to make the type of double Java primitive type. However, if they can be null, then you should program as above, i.e. defensively checking for nulls.
Thank you so much expert,I was struggling with this problem from past ten days you are the one who gave me correct
solution from my question,By understanding the question properly
I need the expert like you for solutions thank you once again it's working fine