Talend Connect
Virtual Summit
JOIN US!
And visit the Customer
& Community Lounge.
May 27-28, wherever you are.

Float.parseFloat, Type mismatch: cannot convert from String to Float

Highlighted
One Star

Float.parseFloat, Type mismatch: cannot convert from String to Float

Dear all,
I try to cast from string to float.
I use java code in a tJavaFlex component : 
row2.coord = Float.parseFloat(row1.coord);

Of course, I select the right type for input (string) and output(float)
But i have an error : 
Type mismatch: cannot convert from String to Float

Thank you in advance for your idea!
Highlighted
Nine Stars
Nine Stars

Re: Float.parseFloat, Type mismatch: cannot convert from String to Float

I suggest to use the tConvertType component instead of diving into custom Java coding. Its use is pretty straightforward and it does what you desire.
Highlighted
Forteen Stars

Re: Float.parseFloat, Type mismatch: cannot convert from String to Float

use 
Float.valueOf(row1.coord)
-----------

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

Best Practices for Using Context Variables with Talend – Part 2

Part 2 of a series on Context Variables

Blog

Best Practices for Using Context Variables with Talend – Part 1

Learn how to do cool things with Context Variables

Blog

Migrate Data from one Database to another with one Job using the Dynamic Schema

Find out how to migrate from one database to another using the Dynamic schema

Blog