Jasper else case does not match if dataprovider is null

I pass a foundset to a Jasper report and in iReport I use the following expression, where is $F{mahnung} declared as Integer in iReport and in Servoy as type Number.:

$F{mahnung} == 1 ? 1
 : $F{mahnung} == 2 ? 2
 : $F{mahnung} == 3 ? 3
 : -1

The expression works for 0,1,2 and 3, but not for null. If the dataprovider is null, I don’t get the desired result -1.

Is this problem, because I pass a foundset to iReport? How can I solve this?

Add the null condition.

$F{mahnung} == null ? -1 
:$F{mahnung} == 1 ? 1
: $F{mahnung} == 2 ? 2
: $F{mahnung} == 3 ? 3
: -1

jasantana:
Add the null condition.

Hmm, seems to work now. Thanks. I already tried the null check, but it doesn’t works before. Is it because it was not in the first line before?