Jump to content
We've recently updated our Privacy Statement, available here ×

Page numbers


upanshuvaid

Recommended Posts

Hi , 

I have a below scenario 

 

1- I have a main report where  i have multiple subreports say 4 which are defined in individual detail band .

2- Each subreport is itself  might repeat .

3- for example if i have subreport 1 ,subreport 2,subreport 3 ,subreport 4 

4- if subreport 1 have 5 page than page number should print from 1-5 and than subreport 3 have 6 page than page numbers should print from 6-11 .

5- if subreport 2 have 4 pages than page numbers should print from 1-4 and than subreport 3  have 10 pages  than page number should print from 5-14.

6- each subreport is having title band where  i have to show page numbers.

kindly help on this to achive this.

Link to comment
Share on other sites

  • Replies 1
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

So if I understand correctly the page numbering should be consecutive over all SubReports, right? 

So either you put them into your MAIN report, then this main report is responsible for incrementing the $V{PAGE_NUMBER} variable. But then you would have to use the Pageheader/-footer of this and wouldn't be able to use the SubReports Title bands.

Of course you also alternatively could pass the current page-number value as SubReportParameter to each subReport.. that would be working fine (Just add outside passed "$P{ParentPageNumber} + $V{PAGE_NUMBER} inside the SubReport(s),) if you just want to print the current but NOT (!) the total page number (so page x/y can't work, as the SubReport don't know how many pages outside will be generated after it has finished itself.)

But luckily there is a new evaluation time in newer versions of JasperReports.... so called "Master". And also two "new" built-in variables $V{MASTER_CURRENT_PAGE} and $V{MASTER_TOTAL_PAGES} were introduced:

If you use a JasperReports version >= 6.x  you can use these variables also in your SubReports Title bands.

Just give it a try!

hth + regards

C-Box

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