Tmap entering 0 for output for null integer input

Five Stars

Tmap entering 0 for output for null integer input

Hey folks,

 

I have the code below trying to set 0 for input integer row where the value is null but I still have null value on output. Any help is much appreciated.

 

Marvel_TV.Cartoonshows ==null||Marvel_TV.Cartoonshows .equals("")?null:new Integer(Marvel_TV.Cartoonshows) 

 

Cheers,

 

Neil.

tmap null integer.jpg


Accepted Solutions
Highlighted
Forteen Stars

Re: Tmap entering 0 for output for null integer input

your logic translated to plain english look like:

- if any of 2 (Marvel_TV.Cartoonshows==null or |Marvel_TV.Cartoonshows is empty) - use null, if no one of them - use new Integer(Marvel_TV.Cartoonshows) 

 

is this logic correct or you must change it?

like

Marvel_TV.Cartoonshows==null||Marvel_TV.Cartoonshows .equals("")?0:new Integer(Marvel_TV.Cartoonshows)
-----------

All Replies
Highlighted
Forteen Stars

Re: Tmap entering 0 for output for null integer input

your logic translated to plain english look like:

- if any of 2 (Marvel_TV.Cartoonshows==null or |Marvel_TV.Cartoonshows is empty) - use null, if no one of them - use new Integer(Marvel_TV.Cartoonshows) 

 

is this logic correct or you must change it?

like

Marvel_TV.Cartoonshows==null||Marvel_TV.Cartoonshows .equals("")?0:new Integer(Marvel_TV.Cartoonshows)
-----------
Five Stars

Re: Tmap entering 0 for output for null integer input

Thats perfect thanks again your help is much appreciated!

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

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch