Error converting data type nvarchar to float.

Five Stars

Error converting data type nvarchar to float.

I am trying to convert a string ( 1223.00) to float in tmap, but it's giving me an error "Error converting datatype nvarchar to float.

 

I tried the following :

Float.valueOf(row1.field1), still it won't run.

 

I also tried

row1.field1!= null ? row1.field1.doubleValue() : null

It says "the method doubleValue is undefined for the type String.

 

Can someone help me with this?

Nine Stars

Re: Error converting data type nvarchar to float.

Please try below.

 

StringtoDouble2.PNG

 

Regards,

Veeru Boppudi
Nine Stars

Re: Error converting data type nvarchar to float.

@Gohan - you need to use parseFloat(),  valueOf() returns a Float (object) and parseFloat() returns float number.

Code - 

Float.parseFloat(row1.field1) 

 

Five Stars

Re: Error converting data type nvarchar to float.

error1.PNG

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch

Downloads and Trials

Test drive Talend's enterprise products.

Downloads

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Download