Jump to content
Changes to the Jaspersoft community edition download ×

page_number in subreport


weloby

Recommended Posts

Hello,

 

I have read a lot of posts regarding page numbers in subreports. Unfortunately I still have problems to solve the following:

 

I have a master report with e. g. 7 subreports in the detail band. The master report has a field with V${PAGE_NUMBER} in the page footer. When filling the report the current page number is displayed.

 

Now I want to display the current page number of the master report in the header of the subreport. I have tried to pass the variable PAGE_NUMBER as a subreport parameter. But this doesn´t work. The first subreport has the correct page number but the subsequent subreports have the same page number.

 

To break down the problem I would be very happy if I can get a list of the subreports and the corresponding page.

 

Any ideas? Please point me to a solution.

Thanks & regards,

Christian

Link to comment
Share on other sites

  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hi,

 

If the subreports are all in the same band, they receive the same value of the PAGE_NUMBER variable which is evaluated only once, when that parent band starts.

So even if you add to the received value, the current page number of the subreport itself, the subreports would still start from the same initial page number.

A solution would be to isolate each subreport into its own separate band using dummy groups like explained here:

http://jasperforge.org/sf/wiki/do/viewPage/projects.jasperreports/wiki/FAQ8

 

I hope this helps.

Teodor

Link to comment
Share on other sites

  • 8 months later...

How about if the subreports are supposed to appear at the end of the main report? We have a main report and 5 subreports which is like a summary. Creating the dummy groups for bands would make these reports appear in the middle of the main report.

 

any way around this.

 

Right now all these subreports exist in the summary band.

Link to comment
Share on other sites

Just a quick reply, I haven't seriously thought it out much, but it may be something to get you started down the right path.

 

Create a "summary" subreport which appears after all the other sub-reports (in its own band or not, depending on page number requirements). That summary report is then composed of other sub-reports (the 5 or so that you've mentioned). These sub-reports can then be in the same band (or different bands depending on your page numbering requirements again).

 

Something like this:

 

************************************

MasterReport:

..subReport1

..subReport2

..summaryReport1

************************************

summaryReport1:

----bandA---- <optional>

..subReport1

----bandB---- <optional>

..subReport2

----bandC---- <optional>

..subReport3

----bandD---- <optional>

..subReport4

----bandE---- <optional>

..subReport5

 

Post edited by: CaptnTony, at: 2008/01/23 16:03

Post edited by: CaptnTony, at: 2008/01/23 16:03

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