Jump to content

New page for each sub report


stephen whitehead

Recommended Posts

Hi there,

 

I am working on a report that contains 8 subreports inside a detail band. All of these subreports have the potential to either not exist (with the exeption of the first subreport always existing), or have 1 to n rows, making the page height an unknown value. I would like it so each subreport starts on a new page. My current solution is this:

Master report

-- SubReport1

-- SubReport2 - With pagebreak at top of title band

-- SubReport3 - With pagebreak at top of title band

-- SubReport4 - With pagebreak at top of title band

-- SubReport5 - With pagebreak at top of title band

-- SubReport6 - With pagebreak at top of title band

-- SubReport7 - With pagebreak at top of title band

-- SubReport8 - With pagebreak at top of title band

This current solution works fine when the contents of previous subreport doesn't take up all of the page height. In cases where the previous subreport does this - the page break from the current subreport no longer fits on the previous subreport's page and instead inserts a page break on the following page. This means there is the occasional blank page in the middle of the report.

My question is - is there a better solution to generating each subreport on a new page, if not, is there a way I can modify the current structure so that I can achieve my desired look?

Regards,

Steve

Link to comment
Share on other sites

  • Replies 5
  • Created
  • Last Reply

Top Posters In This Topic

Here is a suggestion on how I often setup numerous "sub-reports".

Each band can have its own properties.

One of those properties is Start New Page.

I would have each dataset (subreport) in a new detail band.  (right click and add detail band)

You can set the condition on whether they display or not to be if the dataset contains data if you are getting any blanks you don't want.

Link to comment
Share on other sites

I made an example one for you. 

Works fine for me without setting the Start New page property.

My trick is on all reports I create a variable called nothing with an expression of ""  (blank).

Create a new group from the nothing variable.

and sett the reports when no data type to: All sections No detail.

 

I also always set the language from java to groovy because of issues i have seen in the past.

See attachment.

When I toggle from list1 to list2, only the list is visible and at  the top of page.

See the print when expression for the two bands:

$P{SubReportSelector}=="list1" and

$P{SubReportSelector}=="list2"

 

 

 

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