Jump to content
We've recently updated our Privacy Statement, available here ×

jbreuil
Go to solution Solved by bolsover,

Recommended Posts

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

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

  • Solution

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

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...