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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

[resolved] String-->BigDecimal conversion error

Hi All
found here :
https://community.talend.com/t5/Design-and-Development/DATA-TYPE-CONVERSION/td-p/81837
1. String-->BigDecimal
new java.math.BigDecimal(row1.columnName)
trying to do :
new java.math.BigDecimal(row1.price_txt)
in row1.price_txt (DB table) all values : '1234'
get error :
Exception in component tMap_1
java.lang.NullPointerException
at java.math.BigDecimal.<init>(Unknown Source)
at thinkbi_dev.j_context2_test_0_1.j_context2_test.tOracleInput_1Process(j_context2_test.java:1952)
at thinkbi_dev.j_context2_test_0_1.j_context2_test.runJobInTOS(j_context2_test.java:3268)
at thinkbi_dev.j_context2_test_0_1.j_context2_test.main(j_context2_test.java:3020)
Any ideas ?
1952 java code string
out1_tmp.p_bigdec = new java.math.BigDecimal(
row1.price_txt);
Labels (3)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

Yes it was null- I forget to include it in query
though added maunally in scheme
So in DB table it was filled but Null in Talend

View solution in original post

2 Replies
Anonymous
Not applicable
Author

Hi,
Probably your String is null sometimes. To avoid an NPE you could use a structure like this:
row1.price_txt != null ? new java.math.BigDecimal(row1.proce_txt) : null;
Hope this helps.
Regards,
Arno
Anonymous
Not applicable
Author

Yes it was null- I forget to include it in query
though added maunally in scheme
So in DB table it was filled but Null in Talend