Home Subreports
New Blog Posts: Merging Reports - Part 1 and Part 2

Groups and SubReports

edited March 2003 in Subreports
I have a report that has one group band and four sub reports within that
group band. I wanted to manipulate some of the group properties based on
when each of the sub reports was printing. I had code in the subreports
OnPrint event and code in the group OnGetBreakValue event.

What happens is that the group OnGetBreakValue event fires four times before
the subreports OnPrint events fire. How can I have the group event happen
between the subreports OnPrint events?

Thanks,

Tom Knox

Comments

  • edited March 2003
    The group is going to check its break value based on the master report
    datapipeline changing a record. Since the same detail band contains multiple
    subreports, it will never try to check to see if a group break can happen
    until after all the subreports generate forthe one detail band. Do you want
    to force page breaks to start each subreport? You can toggle the
    TitleBand.NewPage property in the subreport or set the
    Subreport.PrintBehavior property to pbSection.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited March 2003
    > to force page breaks to start each subreport? You can toggle the

    If I set the subreport's TitleBand.NewPage property to True, then if the
    subreport has any text/fields in the title band they print on the current
    page and the subreport's detail band prints on the following page. If I set
    the KeepTogether property = True, then the subreport's title band prints on
    a new page and the detail band prints on yet another new page.

    This seems counter-intuitive.

    What am I doing wrong?

    Thank you,

    Tom Knox


  • edited March 2003
    > Subreport.PrintBehavior property to pbSection.

    If I set the subreport.PrintBehavior to pbSection then the entire report
    begins on a new page and this subreport is the first to print and the other
    subreports print. If I have a report with three subreports stacked
    vertically (numbered 1 to 3 from top to bottom) in the report's detail band
    and they are all set to pbChild then the report prints out in that order
    (subreport-1, subreport-2, and subreport-3) on the same page. If I set
    subreport-2 to pbSection then when the report prints there is a blank first
    page with only the report header, then subreport-2 on a second page then on
    page three is subreport-1 and subreport-3.

    My goal is to have the subreports print in their z-order. The subreports are
    created dynamically and there will be a variable number. I want to
    programatically say after this subreport prints start the next one on a new
    page and continue printing the rest of the subreports on this new page until
    the program says to start a new page and then continue printing the
    remaining subreports on the new page.

    The subreport's TitleBand.NewPage is possible, but as I reported in another
    post, the title and detail print on separate pages. Also that only applies
    to that subreport and not to the others that follow - they still print on
    the current page.

    I've seen you recommend the PageBreak component from RBAddOn's. I ordered
    them from their website, but that but the vendor is apparently out of
    business as they didn't send the unlock code and they do not respond to
    email inquiries.

    Other thoughts are appreciated.

    Thank you.

    Tom Knox


  • edited March 2003
    The PageBreak component should work in this case, though I have not tested
    it in this scenario. Bruce Roberts (one of the authors of RBAddOn) and
    ususally is responsive. Try sending them another email to their support
    address.

    The title band does print in a new page in the manner you have described.
    This is the designed behavior. I was trying to throw out some features which
    you may have not been aware which were related to this. Sorry for not fully
    explaining it in detail.

    The section style subreports do print based on their ZOrder in the band. I
    think this is the best approach to solve the problem. Do not place any other
    controls in the band other than section style subreports when you are going
    to use them. Child type subreports are different and print based on their
    position in the band, with other controls, and use the ShiftRelativeTo
    property to reposition themselves correctly below other subreports, much
    like a stretching memo behavior.

    Give the PageBreak component a shot. If that doesn't work, then perhaps we
    can try using the Subreport.OnEndFirstPass to set the main report's
    DetailBand.OutOfSpace to true. Usually setting OutOfSpace is done when the
    entire detail band should be forced to the next page, not parts of it as in
    this case, so it may or may not work as it is setting a condition that is
    intended to only be set inside our internal report engine code.

    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited March 2003
    Jim,

    If you could help me some more I'd appreciate it.

    I did try the PageBreak component that you recommended but could not get it
    to work and cannot get help from Bruce Roberts. Since you recommend RBAddOn
    you should know that my experience with them has not been satisfactory. It
    took them five days after purchasing the software to send the unlock code
    and it has been five more days since I emailed them questions about how to
    use the PageBreak component and I am still waiting to hear back. So at this
    point their product is useless to me.

    Just to restate what I am trying to do, my goal is to have the subreports
    print in their z-order. The subreports are created dynamically and there
    will be a variable number. I want to programatically say after this
    subreport prints start the next one on a new page and continue printing the
    rest of the subreports on this new page until the program says to start a
    new page and then continue printing the remaining subreports on the new
    page.

    Any help you can offer would be greatly appreciated.

    Thanks,

    Tom Knox

  • edited March 2003
    Try this approach. I used DADE for the data access, but see the group
    defined in the second subreport in teh demo in which you can toggle the
    NewPage property to force a page break before the subreports print in the
    detail band.

    http://www.digital-metaphors.com/tips/ForceNewPageSubreports.zip

    --
    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.