hunta007 Posted October 4, 2011 Share Posted October 4, 2011 I am trying to constrain a count of a variable in a group header; e.g. instead of getting the count of all employees in the department group, I want to apply a constraint to have that variable count be only for Female employees. I have a variable that is a count calculation created to group by the department. I assumed it would be as simple as setting the variable expression to $F{gender} == "F", but that doesn't seem to work to constrain the count. Please and thank you for any assistance. Post Edited by hunta007 at 10/04/2011 20:29 Link to comment Share on other sites More sharing options...
lknueve Posted October 5, 2011 Share Posted October 5, 2011 have your variable set to SUM instead of COUNT, make sure the Evaluation time for the text field displaying the variable is set to REPORT, and in the variable's expression, update the code to the following: $F{gender}=="F" ? 1 : 0 Link to comment Share on other sites More sharing options...
hunta007 Posted October 5, 2011 Author Share Posted October 5, 2011 Hi and thank you for your response. When I do this, I am getting an error that the variable expression is not compatible with the variable's class... the class is set to java.lang.integer. Link to comment Share on other sites More sharing options...
hunta007 Posted October 5, 2011 Author Share Posted October 5, 2011 When I remove the spaces from between the last four values of the expression, it works. thank you. The report language is Groovy... why would the spaces initiate that error? Link to comment Share on other sites More sharing options...
hunta007 Posted October 5, 2011 Author Share Posted October 5, 2011 Also, it only works if the text field evaluation time is set to Auto. Report renders zero values. Link to comment Share on other sites More sharing options...
hunta007 Posted October 5, 2011 Author Share Posted October 5, 2011 Thanks again for your help iknueve. Post Edited by hunta007 at 10/05/2011 18:14Post Edited by hunta007 at 10/05/2011 18:16 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