Error converting data type nvarchar to float.

Highlighted
Four 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) 

 

Four Stars

Re: Error converting data type nvarchar to float.

error1.PNG