2006 IR Open Dicussion Posted August 27, 2006 Share Posted August 27, 2006 By: Tony Hanratty - thanratty Sum or Count on conditional field value 2006-03-21 20:00 I am trying to evaluate the number of fields with a certain value. I have a variable declared with the following definition: (($F{area}.equals("North")) ? new Integer(1) : new Integer(0)) I have tried both a SUM and COUNT type, and different evaluation times. But All I get when I print it in the summary band is '0'. What am I doing wrong? Thanks in advance, Tony. By: Tony Hanratty - thanratty RE: Sum or Count on conditional field value 2006-03-21 20:34 I worked it out. The required expression in the variable definition is: new Integer($F{areamember}.equals("true") ? 1 : 0) Calculation type:Sum Reset Type:Report In the report itself, set the evaluation time to now and it works. Hope this helps someone else who can't afford the manual. :-( Phew! Link to comment Share on other sites More sharing options...
kkracko Posted March 25, 2008 Share Posted March 25, 2008 I tried this and it worked! It also works with NOTnew Integer(!($F{STATUS}.equals("Completed")) ? 1 : 0) How could it work if there is more than one condition.($F{STATUS}.equals("Completed") ($F{STATUS}.equals("InProcess") ? Thanks Link to comment Share on other sites More sharing options...
svenn Posted March 25, 2008 Share Posted March 25, 2008 new Integer(($F{STATUS}.equals("Completed") || ($F{STATUS}.equals("InProcess") ) ? 1 : 0) Link to comment Share on other sites More sharing options...
jadonmhale Posted June 24, 2014 Share Posted June 24, 2014 I know this is an old question post but what you had and solved was perfect for my problem, thank you! 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