[Tmap Error] NumberFormatException: For input string

Highlighted
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.

 


Accepted Solutions
Forteen 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
Don't forget to give kudos/accept the solution when a replay is helpful.

View solution in original post


All Replies
Forteen 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
Don't forget to give kudos/accept the solution when a replay is helpful.
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?

Forteen 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
Don't forget to give kudos/accept the solution when a replay is helpful.
Forteen 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
Don't forget to give kudos/accept the solution when a replay is helpful.

View solution in original post

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

 

 

2019 GARTNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

Put Massive Amounts of Data to Work

Learn how to make your data more available, reduce costs and cut your build time

Watch Now

How OTTO Utilizes Big Data to Deliver Personalized Experiences

Read about OTTO's experiences with Big Data and Personalized Experiences

Blog

Talend Integration with Databricks

Take a look at this video about Talend Integration with Databricks

Watch Now