using PAGE_NUMBER + " / " + PAGE_COUNT

0
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
medopal's picture
11
Joined: Mar 18 2008 - 5:15pm
Last seen: 11 years 3 days ago

5 Answers:

0
60 passed by and no comments!!!
medopal's picture
11
Joined: Mar 18 2008 - 5:15pm
Last seen: 11 years 3 days ago
4
Hi,
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:
http://www.jasperforge.org/index.php?option=com_joomlaboard&Itemid=&func...

kind regards,
Christiaan
christiaan_se's picture
Joined: Jul 18 2006 - 11:57pm
Last seen: 3 years 10 months ago
0
thank u, its working now

i thought Page_count should count all the pages, but it seems to work on records.

ur suggestion works great, thanks
medopal's picture
11
Joined: Mar 18 2008 - 5:15pm
Last seen: 11 years 3 days ago
0

Hi, 

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.

IS THERE ANY SOLUTION ? Please ......

svrco's picture
3
Joined: Nov 10 2014 - 5:41am
Last seen: 6 months 1 week ago
1

Hi,

 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

usbean061's picture
Joined: Aug 30 2017 - 4:47am
Last seen: 8 months 1 week ago
Feedback