mdgimm Posted November 14, 2014 Share Posted November 14, 2014 The purpose of my variable to is to count the number of individuals who have a legal status of "PROBATION". My expression is set as such:<variable name="ProbationCount" class="java.lang.Integer" resetType="Group" resetGroup="AgntName" calculation="Sum"> <variableExpression><![CDATA["PROBATION".equals($F{o_lgl_status}) ? 1 : 0]]></variableExpression> </variable>this however returns a count of zero, which I know is false. How can I count or sum a string such as "PROBATION" using Jaspersoft Studio v. 5.6.0? Your clarity in this area is greately appreciated. Link to comment Share on other sites More sharing options...
hozawa Posted November 15, 2014 Share Posted November 15, 2014 Can't you just use sql statement SELECT COUNT(*) FROM yourTablename Link to comment Share on other sites More sharing options...
Ankur Gupta Posted November 17, 2014 Share Posted November 17, 2014 Hi, Possibly the error in counting could be because of any of the following reasons:1. You would have set the Increment Type property wrongly, according to the grouping you have in the report this would vary but, if you have a single group then the default value will do that is None, which will allow to run the count expression to run for every record.2. Other possible error could be that you would have missed on a default value property, this should be set to 0 as you will be further adding on the values.3. Other important aspect could be the reset group you have set, , if you have more than 1 groups then you should place the variable in a place which shows the value before it is reset, that is before the second value of the group is encountered.4. Last but not the least could be that you have placed the variable in the group header or a place where either the calculation is yet not completed or a place where the execution comes after the reset which leaves your variable value unchanged. I would suggest you that if you have more than one groups then gradually check the positioning of the variable.Along with this I am attaching a snapshot of the property window of the variable, Hope that this helpsThanksAnkur Guptaankurthetechie.blogspot.com 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