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

Assigning a report from another dm to Subreport.Report property

edited October 2009 in General
Hi all,

I have a main report, created in a datamodule. This main report has a subreport
object in its summaryband
I want to print another report, created in another datamodule, inside this
subreport object.

After assigning this, i have to stream the template to a memorystream to
create a copy of the whole thing.

I tried the following setup:

srCalcSettings.SetReportProperty(FRBBaseCalcDef.ppReport);

with srCalcSettings being the TppSubreport object, and FRBBaseCalcDef the
"other" datamodule.

When i stream the resulting report with SaveToStream into a memorystream,
and load this stream into another TppReport object with ppReport2.Template.LoadFromStream
the ppReport2.Summaryband.srCalcSettings subreport does not show the contents
of FRBBaseCalcDef.ppReport

What am i doing wrong?

greetz
Bas

Comments

  • edited October 2009

    "After assigning this, i have to stream the template to a memorystream to
    create a copy of the whole thing."

    The best design is to use RB Enterprise to design portable reports that
    contain the data access, code, and layout all inside the report designer -
    all saved as part of the report definition. Then you can save/load a main
    report or a subreport or both. And you do /not/ need to use
    subreport.SetReportProperty.

    Using subreport.SetReportProperty is another technique - it is not
    compatible with loading/saving report definitions. It simply tells the
    subreport.Report to reference another object instance. If you want to
    'create a copy of the whole thing', then I recommend creating a separate
    DataModule instance for the main report and a separate DataModule instance
    for the subreport and then call subreport.SetReportProperty.



    --
    Nard Moseley
    Digital Metaphors
    www.digital-metaphors.com

    Best regards,

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