Multiple subreports with Title/Summary band page break issue

0

Hi all,

I have report with 9 subreports, each represents one table. It's page format is A4 landscape.
In Details band are some details, and in Summary band are those 9 subreports, set to Position Type: Float and with equal height of 30px.
Subreports contain Title (30px height), Column Header (40px height), Details (20px height) and Summary band (30px height).

When I run report sometimes there is a page break after subreport's Title or before subreport's Summary band and it ends up on different page.
I found posts explaining to avoid that behaviour you should set subreport component height to be higher, so it won't have page break after Title or before Summary band.
So I should set subreport's height to be higher than it's Title (30px height) + Column Header (40px height) + Details band (20px height) = 90px to be able to print without unwanted page breaks.
So the question is if there is some other way to achieve this?
If not, how am I supposed to put 9 subreports each at least 90px high into A4 landscape report which has height 595px?

Kind regards,
Dejan

dejanr's picture
5
Joined: Oct 17 2019 - 7:20am
Last seen: 4 weeks 13 hours ago

1 Answer:

0

I've managed to solve this by breaking each subreport into multiple details. This solution solves issue of page break after title or column band as well as before summary band.
With this workaround you need to know total record count before rendering report ($F{totalRecordCount}).
So, instead of just having title band, column band, detail band and summary band these are steps to solution:

  1. created additional 3 detail bands (now there are 4 in total)
  2. Column band now has printing condition : 
    $F{totalRecordCount} > 1 && $V{REPORT_COUNT} > 0
  3. 1st detail band contains title elements + column elements + detail elements (fields to print)
  4. 1st detail band has print condition:
    $F{totalRecordCount} > 1 && $V{REPORT_COUNT} == 1
  5. 2nd detail band contains just detail elements (original details band with fields to print)
  6. 2nd detail band has print condition:
    $F{totalRecordCount} > 1 && $V{REPORT_COUNT} > 1 && $V{REPORT_COUNT} < $F{totalRecordCount}
  7. 3rd detail band contains detail elements (fields to print) + summary elements
  8. 3rd detail band has print condition:
    $F{totalRecordCount} > 1 && $V{REPORT_COUNT} == $F{totalRecordCount}
  9. 4th detail band contains title elements + column elements + detail elements (fields to print) + summary elements.
    It is printed just in case there is 1 record to print
  10. 4th detail band has print condition:
    $F{totalRecordCount} == 1
  11. remove title and summary band, their elements are printed in details

I am still having following issue - column band (step 1) sometimes prints, sometimes it does not.
In some situations printing condition $F{totalRecordCount} > 1 && $V{REPORT_COUNT} > 0 works properly, and sometimes you need to change it to $F{totalRecordCount} > 1 && $V{REPORT_COUNT} > 1 to properly work. This looks like some sort of race condition. 
If anyone knows how to solve this, I would appreciate it.

Kind regards,
Dejan

dejanr's picture
5
Joined: Oct 17 2019 - 7:20am
Last seen: 4 weeks 13 hours ago
Feedback