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

Inserting a report into a subreport

edited April 2003 in Subreports
Hi All,

Simple scenario... two reports on a form.

Report1 contains a SubReport in the Header band... I now want to make this
SubReport show the contents of Report2 (that contains a Title band only).

I have tried *everything* I can think of (with the Report.Template property)
to achieve this, but nothing seems to work for me. I have tried the
"end-user dynamic subreport loading" demo, but it's not exactly what I am
looking for.

Whatever I do seems to result (at runtime) in either a) the preview window
saying 'generating page one' but nothing ever happens, forcing me to click
cancel or b) the page numbers count up endlessly, again forcing me to click
cancel.

Surely this must have been attempted before (it's quite a common requirement
I'm guessing) but I'm blowed if I can get it to work.

DigitalMetaphores, I'd be forever in debt if you could post a small example
as I have spent day's on this and have still got nowhere.

Cheers
Dave

Comments

  • edited April 2003
    Dave,

    Below is a link to a small demo giving an example of what you are trying to
    do. Be sure that the template you are loading into the subreport has its
    AutoStop property set to true and that you load the template before report
    generation.

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

    --
    Best Regards,

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

    Many thanks for the example, I'm almost there but still have a few questions
    and problems :-

    1) Every message on this newsgroup (on this subject) states that you should
    use the Title & Summary bands, but you are using the Detail. Ironically,
    the Detail works and the Title & Summary cause me no end of problems. So
    should the Detail always be used?

    2) Using your example, if I drag the SubReport into the Footer section, it
    will not print... any idea why? I'm seeing this behaviour in my app to, the
    SubReport in a Header section work, but not in a Footer.

    3) The Report that us being loaded into a SubReport has a label called
    'ppHeaderReportTitle', yet once it is loaded, I am unable to find it using
    Report.FindUserObject. I've tried both the 'ppHeaderReportTitle' and
    'HeaderReportTitle' names and it is always returning NIL. How is it
    possible to access the components of the Report that has been loaded?

    Regards
    Dave
  • edited April 2003
    I managed to solve number 3.

    I was looking at the Report not SubReport.Report... DOH! :-)
  • edited April 2003
    Dave,

    1. The reason I used the Detail band was that you are always guaranteed a
    Detail band in any report or subreport. You could use the title or summary
    bands.

    2. A child type subreport will not show up in the footer band. The footer
    band is not made for any kind of stretching control. Try changing it to a
    fixed
    subreport and re-test.

    --
    Best Regards,

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

    Ok, it's working now but not in the way I would have thought.

    I had to set the Detail band on the SubReport.Report to a Static size, not
    Dynamic. I left the SubReport type as a Child and that works fine (as does
    Fixed).

    Out of curiosity, are SubReport's a new feature of ReportBuilder?

    I have only just started using RB for the first time and must admit that,
    compared to the rest of the product (which is excellent), the quirky way in
    which SubReport's are used has been mighty frustrating.

    Thanks for your help anyway, it's much appreciated.

    Cheers
    Dave
  • edited April 2003
    Dave,

    I'm glad you got everything working ok.

    SubReports are not a new feature. They have been included with
    ReportBuilder for many years. They are very flexable and allow you to
    create many reports that would otherwise be impossible.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.