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

Parse XML : error when get "NaN" value for insert in mysql Float field

Highlighted
One Star

Parse XML : error when get "NaN" value for insert in mysql Float field

Hi Everybody,
I'm really novice in Talend Open Studio. It's my first use, but I found lot of documentation about this great product !
I have lot of data as XML files (300Mo) for analyse, and I decided to insert it into a mySQL Database.
The row structure : 1 String, 1 Date, and many Number fields by row.
My architecture : tFileList > tFileInputXML > tMAP > mySQLTableOutput
Everything works good, but I have only one problem :
In the XML file, some "row" have "NaN" value for only some fields, so when Talend insert this row in mysql, mysql reject it, because of the "NaN" value is not a Float I guess.
So, my question is : How can I setup Talend to recognize "NaN" value as a "null" value, to convert it to a "null" or "0" value ?
Thanks for your help !
Dimix.
One Star

Re: Parse XML : error when get "NaN" value for insert in mysql Float field

I thought about a "if" in the Map Field Expression ... ?
Highlighted
One Star

Re: Parse XML : error when get "NaN" value for insert in mysql Float field

I did that : (row1.FIELD.isNaN())?0:row1.FIELD
I don't know if it's the more efficient, but that's works !
Highlighted
One Star

Re: Parse XML : error when get "NaN" value for insert in mysql Float field

Is it legitimate for your XML to contain non-numerical data?

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

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog