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

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.