Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
quentin-vigne
Partner - Creator II
Partner - Creator II

tMap - Assign null values to an Integer

Hello everyone,

First of all, I know the difference between int and Integer, hence why I'm using the Integer type in my tmap by click the "nullable" checkbox.

 

I have a condition which either :

- Get an Integer from a lookup table based on a specific condition 

- If the condition isn't respected but the value is still in the lookup table I want it to be null (not 0)

- Else I'm parsing my existing value using Integer.parseInt(....)

 

 

But I'm getting java.lang.NumberFormatException: null because apparently I can't put null in my Integer column (even tho I should be able to do so)

 

Is there something else I should be doing ?

Labels (2)
1 Solution

Accepted Solutions
quentin-vigne
Partner - Creator II
Partner - Creator II
Author

I found a solution since it wasn't working.

It looks like I could not put in the same "if - else" condition a null result and an Integer.parseInt(...)

 

What I ended up doing was that using the String format in the Var section of the tMap and in the output table I did : 

 

Var.code_societe!=null?
	Integer.parseInt(Var.code_societe)
:
	null  

 

View solution in original post

4 Replies
BraidwoodIT
Contributor II
Contributor II

I'm not totally clear on what you are trying to do but maybe in the input data you are conditional joining too, check that the schema editor has that column as allowed to be Nullable. If not you will get a 0 as the schema doesn't allow NULLs. I got caught out by that. 

Shicong_Hong
Employee
Employee

Can you show the expression you are using on tMap? If you just want to assign a null value to a Integer column, to do:

  1. Define a context variable with Integer type, let the value as empty. 
  2. Make sure the Integer column is nullable, use the context variable in the place where you need to assign null value.

Regards

Shicong

 

quentin-vigne
Partner - Creator II
Partner - Creator II
Author

Everything is checked for Nullable, but I found a getaround solution that works

quentin-vigne
Partner - Creator II
Partner - Creator II
Author

I found a solution since it wasn't working.

It looks like I could not put in the same "if - else" condition a null result and an Integer.parseInt(...)

 

What I ended up doing was that using the String format in the Var section of the tMap and in the output table I did : 

 

Var.code_societe!=null?
	Integer.parseInt(Var.code_societe)
:
	null