Dduffek Posted September 7, 2006 Share Posted September 7, 2006 Hi. I have a report that will be have rows of data and captions. I don't know how many rows of data will exist, but I want to place a bar after every 2 caption rows. I have a field that can tell me if a row is a caption or a data, and I can handle placing the bar, if I know how many captions I have printed up to that point. What I need to figure out is how to keep track of the number of captions that have been printed. I think I need a variable, but I am unsure of how to format the variable. I think I need something similar to this:Code:<variable name="CaptionCount" class="java.lang.Integer" resetType="Report" calculation="Count">variableExpression><![CDATA[($F{Type}.equals("caption"«»)? increment count: do nothing)]]></variableExpression><initialValueExpression><![CDATA[new Integer(0)]]></initialValueExpression></variable> Anyone have any ideas? Thanks for any thoughts you might have. Duffek Link to comment Share on other sites More sharing options...
lucianc Posted September 8, 2006 Share Posted September 8, 2006 calculation="Count" counts all the not-null values, therefore you needCode:<variable name="CaptionCount" class="java.lang.Integer" resetType="Report" calculation="Count"> <variableExpression><![CDATA[($F{Type}.equals("caption"«»)? "count me" : null)]]></variableExpression></variable> You can also use SumCode:[code]<variable name="CaptionCount" class="java.lang.Integer" resetType="Report" calculation="Sum"> <variableExpression><![CDATA[($F{Type}.equals("caption"«»)? new Integer(1) : new Integer(0))]]></variableExpression></variable> HTH,Lucian Link to comment Share on other sites More sharing options...
Dduffek Posted September 8, 2006 Author Share Posted September 8, 2006 Thanks! It works like a charm! Duffek 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