How to handle null in Talend ?

Highlighted
Four Stars

How to handle null in Talend ?

Good morning,

I'm having the following issue:

 

I'm getting a csv file containing data I want to write to the stage DB.

one of the fields is an integer and sometimes  I get "null".

It Looks like Talend is not interpreting this as null , rather as a string.

How can I avoid the following message :?

 

Couldn't parse value for column 'processor_count_pending_general_purpose' in 'in_zCPC, value is 'null'. Details: java.lang.NumberFormatException: For input string: "null".

 

The dataset looks like :

IBM.296409-0008456600;CPU1;00012345A7F97;N63;2964;NO;null;19;12;0;5;1;0;1;38;0;0;0;null;0;0;0;719;719;719;2695;2695;2695;true;true;false;true;0;1620165599000;5;true;true;false;999;180524-211815;

 

Kind Regards

 

Michael

Nine Stars

Re: How to handle null in Talend ?

While you have retrieved your data from csv and you have prepared your schema you might had selected "string" for that specific column if you are worried if the data type is treated as "string".

If you are transforming your retrieved data through tMap then you could add the condition to check for NULL values and then process the values as per your criteria - 

(Relational.ISNULL(row1.processor_count_pending_general_purpose) || row1.processor_count_pending_general_purpose.isEmpty() || row1.processor_count_pending_general_purpose.toString() == null) ? (true do something) : (false do something else)

 

Tutorial

Introduction to Talend Open Studio for Data Integration.

Definitive Guide to Data Integration

Practical steps to developing your data integration strategy.

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.