Skip to main content
Announcements
Introducing Qlik Answers: A plug-and-play, Generative AI powered RAG solution. READ ALL ABOUT IT!
cancel
Showing results for 
Search instead for 
Did you mean: 
sbxr
Contributor III
Contributor III

Check null for a column having integer datatype and Replace with some number or "undefined"

Hi Team,

 

I have columns in my  data which has some null values and want to replace it with some integer value such as 0. and other null values with undefined.

 

like for string we do it like : 

row1.test==null ||

row1.test==null?"undefined" :row1.test1

 

Want it for int

 

Regards

Labels (2)
1 Solution

Accepted Solutions
fdenis
Master
Master

if you want to have Integer and Strings (undefined) on the same column… all your data will be String
"0"
"1"
"undefined"


if your input column can be null it's an Integer (object (not an int)) so you have to convert it to String.

(row1.test==null)?"undefined" :row1.test.toString()

View solution in original post

6 Replies
TRF
Champion II
Champion II

row1.test == null ? "Undefined" : Integer.toString(row1.test)
fdenis
Master
Master

if you want to have Integer and Strings (undefined) on the same column… all your data will be String
"0"
"1"
"undefined"


if your input column can be null it's an Integer (object (not an int)) so you have to convert it to String.

(row1.test==null)?"undefined" :row1.test.toString()

TRF
Champion II
Champion II

Did this help?

If so, thank's to mark your case as solved (Kudos also accepted).

sbxr
Contributor III
Contributor III
Author

Yes it is working as I wanted ..

 

Thank you very much..

TRF
Champion II
Champion II

@sbxr, so you could validate the 1rst answer, not the 2nd one which is just a copy of the previous one.

When you help someone, do you like that the thanks go to someone else than you?

I don't!

sbxr
Contributor III
Contributor III
Author

Yes you are right @TRF .. 

my thank you is for every one in general..

 

Pardon me and respect

@sbxr