Jump to content

How to get the page number of a subreport


sunianu

Recommended Posts

Hello....

I have one master report with 40 subreports . I placed page number in the Page footer section of master report.

All sub reports are displaying correctly  with page numbers. How can I get page number of each subreport in the main report ? or how can I get on which page the subrport s displayed ?

 

Thanks

Suni

 

 

 

 

 

Link to comment
Share on other sites

  • Replies 7
  • Created
  • Last Reply

Top Posters In This Topic

Just pass the $V{PAGE_NUMBER} from Master to SubReport to get to know the current PageNumber from Master in SubReport.

The other direction would be a SubReport Return Variable, where you can return the SubReports LastPageNumber back to MasterReport.

 

just try a bit

hth

C-Box

Link to comment
Share on other sites

Hmm, if I understand right, you want to show the amount of pages the SubReport has.

So if you want to show the TotalPageNumber (or LastPageNumber) of a SubReport you have to use a ReturnVariable that is returned from SubReport back to MasterReport where it can be shown.

See the SubReport-Sample how to use ReturnVariables and what attributes has to be set in MasterReport to show the ReturnVariable.

hth
C-Box

 

Link to comment
Share on other sites

I am trying to do a related thing. In my subreport the $V{PAGE_NUMBER} Variable when Evaluation time is set to "Report" it outputs the total Pages of the subreport.

Is it possible to pass this Variable to the Master Report? I have tryed by doing:

<returnValue subreportVariable="PAGE_NUMBER" toVariable="Pages"/>

But If I output $V{Pages} in the Master it output only null. Is this not possible?

Thanks



Post Edited by Kolja Ehlers at 11/12/08 11:21
Link to comment
Share on other sites

Have you set the SubReportVariable (eg. $V{"SubRepTotalPages}") to the MasterReportVariable (eg. $V{RetVar_SubRepTotalPages}) in the SubReport Return Variables Properties ??? (like shown in SubReport Sample provided with JasperReports Full Download package)

 

Be aware not to reset the MasterVariable (eg. $V{RetVar_SubRepTotalPages}) and to set the EvaluationTime to "Report" instead of Now.

 

Must work (done something similiar some month ago for a customer of us)

 

C-Box

Link to comment
Share on other sites

  • 8 years later...

Hello there , sorry for asking my question here .. but i think it's related to the same topic .

i have a sub-report that that will be used as a generic footer in all of my reports. how i can display the page number of each report inside this footer.

for example . i have sub-report called footer that contains the page number . and i have a report called Myreport.

now i will drag this subreport inside MyReport. and i expected to see number of total pages displayed at footer (page 1 of 5 ) for example.

any support will be highly appreciated.

Thanks in advance.

 

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