jbreuil Posted April 11, 2014 Share Posted April 11, 2014 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 Link to comment Share on other sites More sharing options...
Solution bolsover Posted April 12, 2014 Solution Share Posted April 12, 2014 Instead of using the IF() function and assuming you are using Java as the language you could try:$F{GENDER}.trim().equals("Men") ? 1 : 0The 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 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now