Jump to content
JasperReports Library 7.0 is now available ×

Preventing group splitting; combining reports


jerryb8

Recommended Posts

Hi

 

I am currently assessing Jasper/iReport for my employer, so I've picked a couple of our existing reports to see how easily they could be created.

 

I've hit a couple of problems which are probably due to my inexperience. If anyone can suggest answers or point me at documentation/examples, I'd be grateful.

 

1) Preventing a group from splitting over a page.

 

I have many small groups on each page (grouped on Customer, with repeating lines on outstanding orders). I need to ensure that if a group doesn't fit on one page, it doesn't split. At the moment I'm finding that the heading will appear at the bottom of one page, and again at the top of the next. In some cases, a couple of detail lines appear at the bottom of one page, and the others at the start of the next.

 

In "Band properties" for "detail", I've un-ticked "Split allowed", but this makes no difference. On the CUSTOMERheader and CUSTOMERfooter bands I've also un-ticked "Split allowed".

 

In the "modify group" dialog box I can unset "Print header on each page", and this prevents the header reappearing, but this can cause an orphaned detail line to appear at the top of the second page, of course.

 

I've adjusted "Min height to start new page" to 160, and whilst this prevents even the largest group from splitting, it leaves a lot of empty space on most pages which could be filled with small groups.

 

Is there some way to tell iReport/Jasper to only start a group if its got enough room for that group on the page in question?

 

 

2) I need to print the results of two quite separate queries in one report (this is a user requirement). For example: customers with outstanding orders, and customers who cancelled their last order. I cannot see any way to do this.

 

 

Sorry about the length of this post - and I hope I'm not missing anything obvious.

 

Jerry

Link to comment
Share on other sites

  • 3 weeks later...
  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Hello Jerry,

not sure I can help you with your first problem, since I haven't run into anything similar yet. But for number '2', you can try to use subreports.

What I do is I pass a JREmptyDataSource to my main report(no data in here, just headers, footers, company name, etc). Then I have two subreports, where the datasources are passed in as parameters, and I just forward those data sources to my subreports.

hope this helps,

RC

Link to comment
Share on other sites

  • 3 weeks later...

Jerry, try putting your subreports into pageHeader.

For some reason pageHeader appears to be the only place in order to avoid repetition of data. I had to make my subreports fit individually onto one page before I combined them. But here is one other problem: what if the reports need 2 separate pages? I don't know if there is a way to tell iReport to use a separate page for specific iReports...

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