Seven Stars

[Tmap Error] NumberFormatException: For input string

Hello,

 

There's a simple job below:

Capture11.JPG

Here is my input csv:

Capture16.JPG

 

My Tmap in details:

Capture18.JPG

 

Condition1 is working well which remove space and replace comma with dot and null to "0:

 

row1.newColumn1==null | row1.newColumn1.equals("")?"0":
row1.newColumn1.contains(",")?row1.newColumn1.replace(",", "."):
row1.newColumn1.contains(" ")?row1.newColumn1.replace(" ", ""):
row1.newColumn1 

 

Condition2 is working well too (same as condition one)

 

row1.newColumn2==null | row1.newColumn2.equals("")?"0":
row1.newColumn2.contains(",")?row1.newColumn2.replace(",", "."):
row1.newColumn2.contains(" ")?row1.newColumn2.replace(" ", ""):
row1.newColumn2 

Condition3: ERROR found: (Trying to keep value to two decimal place and of type string)

String.format("%.5f", (Double.parseDouble(Var.var1) - Double.parseDouble(Var.var2))) 

Capture14.JPG

 

Tried hard but couldn't identify the issue.

 

Can you advice please?

 

Thank you very much.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Twelve Stars

Re: [Tmap Error] NumberFormatException: For input string

@asadasing,can you re-write cloumn1 and cloumn2,variable expressions as below.should work if you have space issue.

 

row3.newColumn2==null | row3.newColumn2.equals("")?"0"Smiley Sadrow3.newColumn2.replace(",",".")).replace(" ","")

Manohar B
6 REPLIES
Twelve Stars

Re: [Tmap Error] NumberFormatException: For input string

@asadasing,cant you try to convet to Float instead of Double,your issue will be resloved.

example:-

Float.parseFloat()

Manohar B
Seven Stars

Re: [Tmap Error] NumberFormatException: For input string

Do you know the reason of this error?
It was working fine before.
Seven Stars

Re: [Tmap Error] NumberFormatException: For input string

The solution you provided is not working.

 

I have tried to convert using float and encountering same error.

 

Float.valueOf(String)

 

And also

 

Float.parseFloat(String)

 

Can you advice please?

Twelve Stars

Re: [Tmap Error] NumberFormatException: For input string

@asadasing,your have space or tab between 1 and 4 of 1 430.76. becuase of the your were getting error,you nee to replace that with empty.

Manohar B
Twelve Stars

Re: [Tmap Error] NumberFormatException: For input string

@asadasing,can you re-write cloumn1 and cloumn2,variable expressions as below.should work if you have space issue.

 

row3.newColumn2==null | row3.newColumn2.equals("")?"0"Smiley Sadrow3.newColumn2.replace(",",".")).replace(" ","")

Manohar B
Seven Stars

Re: [Tmap Error] NumberFormatException: For input string

This one works fine.

Indeed the contain function (.contain) was not working OR it could not recognize the space in the string.

 

Thank you very much. Issue marked as solved.

 

Best regards,

asadasing