How do i get a null int/Integer

One Star

How do i get a null int/Integer

Hello,
I have a trouble in a tMap when i am trying to map with a left join and compare after the value of the key to update or insert.
the problem is the key is a number, and Talend cast it in int rather than Integer so it's value can't be null.
How can i cast it in Integer knowing that's it's just the output of DBinputcomponent, i don t see any options.

Five Stars

Re: How do i get a null int/Integer

Schemas allow you to specify if a column is nullable. This usually determines if it is an int or an Integer. You need to make it nullable. If it is, then there's something else not right.
One Star

Re: How do i get a null int/Integer

It's not, and if i change it my problem is solved.
But the trouble i have here is that the column isn't nullable in my DB. I have to specify it just for the left join case i don't get the logic behind this, for me it's a bug.
The question is pretty simple : why is my variable equal to 0 even if it doesn't exist as a left join not matching value.
Five Stars

Re: How do i get a null int/Integer

Your original question was how to use Integer rather than int. Checking nullable is the answer.
I'm do not know what the relevance of the column not being nullable in your DB, is. You need to explain the problem more.
There is no bug, here.
One Star

Re: How do i get a null int/Integer

My column is not not nullable because it's the key.

I have a tmap, 1 main stream M and 1 lookup Stream L.
I do a left join on the key because both streams have the same structure.
What i want is to check in my output if the the row is joined or not.
So i basically test the value of the lookup Stream key which is an int as a not nullable primary key (which seems pretty normal)
When i test the value it return 0 in the case of a non matching row. As a possible value for my key i can't test 0, plus i dont know why Talend translate the void in 0 which is a correct value.
Six Stars

Re: How do i get a null int/Integer

Hi,
is your column int or Integer?
With int, null is not allowed, so TOS return 0 if lookup is null.
I don't know if =null works with Integer....
One Star

Re: How do i get a null int/Integer

if=null works with integer and not with int.
But if i want an integer i have to cross the nullable case which is kind of problematic as a primary key value, and it will change my value in-built
Six Stars

Re: How do i get a null int/Integer

Fwandz wrote:
if=null works with integer and not with int.
But if i want an integer i have to cross the nullable case which is kind of problematic as a primary key value, and it will change my value in-built

Ok, I understand and I share your question (I'had same problem, solved beacuse I can test a string column also available).
It sholud be useful if TOS has a lookup flag to test (it is available in others ETL program, for example).

A workaround may be to insert a tMap and convert int to Integer, so you can use repository metadata and also have nullable column for lookup.

Bye

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

Definitive Guide to Data Quality

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

Download