Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I am having a common and simple issue with String to BigDecimal conversion.
Input: string
Output: BigDecimal
column name: Id
Inside t-map I am putting the below code in One2One mapping.
(Id.isEmpty() || Id.equals("")) ? null : new BigDecimal(Id)
I don't see any error in Code view but after running I am seeing the error. I have also tried
(Id.isEmpty() || Id.equals("")) ? null : java.math.BigDecimal(Id)
Execution Error
[statistics] connected
[FATAL]: talend_default.Ex_Job- tMap_2 null
Exception in component tMap_2
java.lang.NumberFormatException
at java.math.BigDecimal.<init>(Unknown Source)
at java.math.BigDecimal.<init>(Unknown Source)
at java.math.BigDecimal.<init>(Unknown Source)
at Ex_Job.tMSSqlInput_1Process(Ex_Job.java:2923)
at Ex_Job.tMSSqlConnection_1Process(Ex_Job.java:1011)
at Ex_Job.tMSSqlConnection_3Process(Ex_Job.java:781)
at Ex_Job.runJobInTOS(Ex_Job.java:4806)
at Ex_Job.main(Ex_Job.java:4585)
May be you are getting non numeric values in ID from source like space or alpha numeric.
Regards,
May be you are getting non numeric values in ID from source like space or alpha numeric.
Regards,
@Tasfiahm,can you try to run with Debug mode and see the data,which is failing in tMap?
use the below expression should work as default if there is no data issue
Id== null || "".equals(Id)?null : new BigDecimal(Id)
You are exactly right. As the data was coming as a string, it was also coming with space, so I have to trim the row before applying the BigInt conversation.
@Tasfiahm. please accept the solution,which one is right.