Home General

How to add "Continue..." for a child subreport when using a pagebreak?

I have a report that is grouped by patient name. Within its detail I have a subreport that is grouped by the patient visit date. Everything works as it should. It prints the patient's general info on the first page and then it prints the report detail for each visit date for that patient (which is coming from the subreport) page after page. All first occurrences of the visit date does not show "Continued..." as it should. If the data for the same visit date for the same patient extends to another page, then it says "Continued..." on the next page as it should. I am using the following code on the BeforePrint of the Header of the subreport to achieve this:

ppLVisContinue.Visible := not ppChildReport1.Groups[0].FirstPage;

However, when I add a TppPageBreak in BeforePrint right before the code above, then "Continued..." no longer prints properly. I believe the issue occurs because when the BeforePrint is fired during the first occurrence of a visit date, then "FirstPage" = True. But then after it performs the page break during the first occurrence in the BeforePrint, then it breaks to the next page and sets "PageBreak" = False. So my FirstPage above is getting a value of False instead of a True even though the first page has not printed yet for that group.

How can I know if a group is starting after a page break and not show "Continued..."? Then how do I know if the same group (or same visit date) extends to another page and show "Continued..."? BTW, page breaks will only occur when a visit date changes after the first page of the patient has printed.

Thanks in advance for you help.

Comments

  • RonRon
    edited January 2022
    I forgot to mention that I originally was handling the page break within the Group settings of the subreport. On Group Change (or on the Visit Date change) I checked "Start New Page". This seemed to work correctly on page beaks except for the first page. It was doing a page break on the first visit date before it was even printed. If there is a setting somewhere to skip the first record, then I think this approach might solve my problem.
  • Hi Ron,

    In our tests, using the Start New Page feature gave the effect you are after.

    The Group.NewPage feature ("Start New Page") does not (should not) break to a new page for the first iteration of the group. In our tests with the latest version of ReportBuilder and a standard master-detail report (similar to what you described above) this is the behavior we saw.

    I suggest trying this method again with a simple example and your data, then moving that to concept to your main application.

    The TppPageBreak component should only be used in simple reports and sparingly as it forces an overflow condition in the Report Engine. This can be problematic when used frequently and in certain events.


    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • Hi Nico,

    Thank you! I ended up doing what you suggested and using the Group to start the new page with "Start New Page". However, the new page continued to come up for the first iteration. I started looking at what I was doing on the main report page and I had two groups defined, one within another. The reason I originally did this is so I could have two headers, one for the first page and the other for subsequent pages. I ended up removing one of the groups and instead had two regions in the main group header. I now toggle between the two depending on if PageNo=1. When I made this change, it stopped breaking a new page on the first iteration. I didn't make any other code changes. So it had something to do with the two groups.

    Thanks again for your help.

    Ron
Sign In or Register to comment.