Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi experts,
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
Regards
A.Sumanth
Community all-star, @rhall, wrote a very nice guide on how to identify which rows are causing errors in a tMap:
https://www.rilhia.com/quicktips/quick-tip-how-debug-tmap-errors
If this works for you, throw him some kudos.
Are you sure it is row18 or row1 the object?
Please provide screenshots of your job and tMap mapping. Not sure what it is.
Community all-star, @rhall, wrote a very nice guide on how to identify which rows are causing errors in a tMap:
https://www.rilhia.com/quicktips/quick-tip-how-debug-tmap-errors
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
Regards
A.Sumanth