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

Printing only the selected sub-report from the list of sub-reports

edited October 2003 in Subreports
Hi.

I need some assistance with the subject.

I have a report that consisted of 2 sub-reports (summary and detailed) and I
want to be able to print sub-report 1, sub-report 2, or both.

I got it to work but I always get a blank page.

This is how the report is setup.

Main page
Title, Detail [, and Footer] bands

First sub-report is on the Title band and the second sub-report is on the
Detail band.
With that configuration, I get the sub-report 1 printed, a blank page
printed, and the sub-report 2 gets printed. So, I tried setting the
detailband.visible to FALSE and move the sub-report 2 to the footer page but
the printing hangs on the detailband printing. It says "calculating page
x..." and never completes.

I've tried all different combinations but I either get a blank page or the
printing hangings.

I am using JITPipeline as the datasource because we have in-house data
object to load the data.

I need to be able to select which sub-report to print. I could use the two
separate reports but then I have to query the database twice to get the same
data. Also, I have another report that needs 5 sub-reports from the same
data queried and the user could select to run all 5 reports or only one.

Any help will be greatly appreciated.

TIA,

P.S. I have an UI form for the user to select which (sub) report to run.

SeHun

Comments

  • edited October 2003

    You do not specify whether the subreports are set to pbChild (the default)
    or to pbSection.

    1. Below is a simple pbChild configuration


    main
    titleband
    detailband
    subreport1
    subreport2
    footerband

    With the above configureation you would need some code like this:

    Subreport1.Visible := (some condition);
    Subreport2.Visible := (some codition);

    if Subreport1.Visible and Subreport2.Visible then
    SubReport2.ShiftRelativeTo := Subreport1
    else
    SubReport2.ShiftRelativeTo := nil;

    myReport.Print;

    2. Below is a simple pbSection configuration. With the section subreports,
    the main report should contain only a detail band (no header/footer or
    title, etc). Each section will start on a new page (like a separate report)
    and will have its own header/footer.

    main
    detailband
    subreport1
    subreport2


    With the above configureation you would need some code like this:

    Subreport1.Visible := (some condition);
    Subreport2.Visible := (some codition);

    myReport.Print;

    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
  • edited October 2003
    Hi Nard,

    Thank you for the tips. Sorry...I am using pbSection. I am still getting a
    blank page.

    Now, I think, maybe, that is because I have the header and footer bands,
    tough the footer band does not print a blank page.

    You see, I have a hierarch for our reports so that I don't have to
    type-in/place the same report header and footer for all the reports we have.
    Also, this gives us uniform looks on all of our reports.

    Now, the problem is the just that. I cannot remove the header and the
    footer bands--defined in the parent form.

    I have set the visibility of the header and the footer bands to FALSE, but I
    still get a blank page--the vary first page. I don't know what is printing
    that blank page. I have put the a visible label on the detail band and that
    printed at the end of the report.

    Do you have any other suggestions?

    I think I can just have two different ppReport components and point to the
    same pipeline, but that does not seem to be a good solution.

    Thanks,

    P.S.
    I wonder....can we sub-class the TppReport and TppSubReport and the designer
    so that our TppReport descendant component can be used instead of TppReport
    on IDE and Runtime?

    This very well solve this and my hierarch problem...
  • edited October 2003

    You need to remove the header/footer from the main report so that it
    contains only a detail band. Each section must print its own header/footer.
    Section style subreport each print like a separate report. Child style
    subreports print on the parent's page space. Child report's use the parent
    reports Header/Footer. Child style subreport do not print their own
    header/footer. They can have Title/Summary or GroupHeader/GroupFooter. These
    are the fundamental of RB.



    If you need to replicate the header/footer layouts in each section, try
    using subreports set to pbFixed for the header and footer. Save them to .rtm
    and then load them into each section subreport.



    --
    Nard Moseley
    Digital Metaphors
    http://www.digital-metaphors.com

    Best regards,

    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com
This discussion has been closed.