hello,
I have this expression : IF($F{GENDER}=="Men",1,0) the field is a string
I have the option calculation on "sum" and the value class name on "java.lang.Integer" , but every time i go preview it return me null
Can you help please
thank you
1 Answer:
Posted on April 12, 2014 at 1:33pm
Instead of using the IF() function and assuming you are using Java as the language you could try:
$F{GENDER}.trim().equals("Men") ? 1 : 0
The IF() function will always return null when the argument is null.
To modify my suggestion to account for null values, you would need something like:
$F{GENDER} != null && $F{GENDER}.trim().equals("Men") ? 1 : 0 db