How to handle null in Talend ?

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)

 

15TH OCTOBER, COUNTY HALL, LONDON

Join us at the Community Lounge.

Register Now

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

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

6 Ways to Start Utilizing Machine Learning with Amazon We Services and Talend

Look at6 ways to start utilizing Machine Learning with Amazon We Services and Talend

Blog