Jump to content
Changes to the Jaspersoft community edition download ×

using PAGE_NUMBER + " / " + PAGE_COUNT


Recommended Posts

hi all, thank u or this nice forum.


my question is, how to use page_number and page_count variables to make an expression like this: (Page 1 of 5), where the 1 is the current page and the 5 is total.


i know it seems easy, but when the report contains, 5 or 6 sub-reports and a few crosstabs (that can split into pages), the page count gives always the wrong result, i think because its calculated after all the sub-reports are filled!!, but the problem is some of the sub-reports will be filled in the 5th page, and i want the total number of pages to appear on the footer of all the previous pages


BTW, i tried to postpone the evaluation time of the page_count text field and still wrong, it keeps giving 1 (and sometimes 0)


thx in advance

Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic


you have to use two separate textfields (instead of one) using the same variable PAGE_NUMBER, but setting different evaluation time


current page: JRExpression.EVALUATION_TIME_NOW

total page count: JRExpression.EVALUATION_TIME_REPORT


Note, this has also been described in:



kind regards,


Link to comment
Share on other sites

  • 9 years later...


I have a big problem. I need to pass information about current page and total page count into the BARCODE.

I can choose, even I want to evaluate BARCODE with EVALUATION_TIME_NOW or EVALUATION_TIME_REPORT.

But, if I choose EVALUATION_TIME_NOW, I have no idea how to get Total pages count

if I choose EVALUATION_TIME_REPORT., I have no idea how to get Current page.


Link to comment
Share on other sites

  • 2 weeks later...


 I have done it on ireport 5.2.0 quite a while ago. 

Create a variable $V{REPORT_PAGE} with properties as below.

Variable Class : Integer

Calculation : Nothing

Reset Type : None

Increment Type : Page 

V.Expression : $V{PAGE_NUMBER}

Now add a text item to your footer with expression as below.

"Page "+$V{REPORT_PAGE} +" of " +$V{PAGE_NUMBER}

and SET Evaluation Time to Auto

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