Home DADE

replacing data module

edited December 2003 in DADE
i am using some Digital metaphors sample code (ReplaceDataModule.zip) to
replace the datamodule in a report with another datamodule loaded from a
template.

However if a data module is loaded into a report that has a subreport, the
subreport loses its data pipeline. This happens even when the data module
that is being loaded into the report has the same dataviews as the orginal
the report is designed on. Is there a way to load the data module and
retain the subreport's datapipeline??

The purpose of this exercise is that the datamodules templates for all the
reports are stored seperately to the report designs. Each time the report
is loaded, it reloads its data module from the separate template. This
allows changes to be made to a single datamodule and have all dependant
reports load through the new changes the next time it is designed.


many thanks
Cameron Hart

Comments

  • edited December 2003

    You will need to iterate thru the subreports and reconnect them to the
    appropriate datapipeline.

    You can use the Report.GetSubreports method to obtain a list of all
    childreport objects. (see the RBuilder.hlp for a method description).

    example: (I did not compile or this)

    uses
    ppClass, ppReport;

    var
    lSubReports: TStringList;

    begin

    lSubReports := TStringList.Create;

    myReport.GetSubReports(lSubReports);

    for liIndex := 0 to lSubReports.Count-1 do
    begin
    lChildReport := TppChildReport(lSubReports.Objects[liIndex]);
    lChildReport.DataPipeline := myDataPipeline;
    end;


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

    Best regards,

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