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

Announcements
Join us to spark ideas for how to put the latest capabilities into action. Register here!
cancel
Showing results for 
Search instead for 
Did you mean: 
johnan
Creator III
Creator III

Get Post with null in ODD

Hi, i got a calculation with odd function that gives me -1 or 0 if it's even, but i want to have this null values, can i set some value, like 3 if it's odd in script?

Even get me null and even gets me -1 or 1

 

 

Br

1 Reply
Martijn_W
Contributor III
Contributor III

Yes you can, the ODD() function is a boolean function that only evaluates integers, meaning it will return NULL if you try to evaluate decimals.

You can simply use the following expression to change to outcome:

if(ODD(<insert number field>)=-1, 3,1) AS OddNumber

in natural language: If the number I want to evaluate is an odd number, you're returning the value -1 for true, if that's the case, give me three instead, if it's not give me 1.