views:

2294

answers:

3

I have added the footer "Page x of x" to my report, but the PAGE_COUNT doesn't seem to work, maybe because I have many subreports?? I get:

Page 1 of 1

Page 2 of 0

Page 3 of 0

Page 4 of 0

Any ideas? Thanks!

+1  A: 

I found the solution.

http://jasperforge.org/tracker/index.php?func=detail&aid=2873&group_id=102&atid=612

But the book JasperReports for Java Developers (p 146) says that PAGE_COUNT is the total number of pages in the report. I guess the bug is in the book.

Actually, PAGE_COUNT is calculated like other variables, so you can get the state of it along the way. (a feature, not a bug :-)
sventech
+1  A: 

our reports look like :

http://pastebin.com/m401fa41

1st part, interpreted during page generation, gives the # of the current page (evaluationTime="Now") 2nd part, interpreted at the end of the report , gives the total # of pages (evaluationTime="Report")

HTH

chburd
Your sample further helped me place the two fields to forma seamless legend. Nice trick, aligning the first one to the right and the second one to the left. I wish things were more "floatable" in JR.
A: 

Thanks! Changing the evaluationTime="Report" solved the problem.

Kwex.

Kwex