Jump to content
Changes to the Jaspersoft community edition download ×

Grouping Rowcount and Row number


Recommended Posts



I am a newbie of ireport. May I know how can I create two variables for row number and rowcount within a group


The idea is similar to below.


Staff 1


1. 2007-01-01 8

2. 2007-01-02 8

3. 2007-01-03 8

Total 3 Days 24


Staff 2


1. 2007-01-01 4

2. 2007-01-02 8

3. 2007-01-03 4

4. 2007-01-04 6

Total 4 Days 22


Many Thanks,


Link to comment
Share on other sites

  • Replies 8
  • Created
  • Last Reply

Top Posters In This Topic

You don't need to create variables, it's already done for you.



For each group there is a row counter variable called $V{yourgroupname_COUNT}



You can use group row counter variables directly in a java.lang.Integer Text Field. Simply set the Text Field Expression to be $V{yourgroupname_COUNT}, set the Calculation Time to Now, and make sure the Textfield Expression Class is java.lang.Integer.



Please note that the value of group row counter variables is zero (0) within any header context, so they are only effective within detail and footer sections. The value of a group row counter variable in a group footer will be the same as the last value in the detail section, as shown in your sample.




Post edited by: jmurray, at: 2007/01/30 01:04

Link to comment
Share on other sites

It's the same variable, you just place it in a Text Field in the Detail band. It auto-increments with each row in the Detail band until the entire group is filled. Then it resets to zero and starts incrementing again with the first row in the next group
Link to comment
Share on other sites

  • 1 month later...

:huh: i need your help... I have two subreports with a group each one, and i have to show only ten records of each one per page. So, i really don't know if i have to fix the detail band, or if i can use the Report_count variable. I'm using the version 1.3.0 of ireport, in your previous answer you said that this version contain an element "Force a New Page"... I´m looking for it, but i can't found it..:dry: please I need to know if it show only a determinate number of records per page.. :side: I hope that anyone can help me... :S



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...