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

Dynamic Subreport Loading.

edited February 2002 in General
Hello,

Still not to get to see the myDynamicLoadingSubReport connection and myEURpt
when I visualize the report and appears the class registered
TmyDynamicLoadingSubReport.

I need to create Headers and Footers pattern and I didn't still discover as.
I already saw the example: .. \RBuilder\Demos\3. EndUser\5. Dynamic
Subreport Loading

Some clue and or documentation?

Thank you

Anderson

Comments

  • edited February 2002
    When you run the report, the subreport class that is registered, is used to
    generate the subreport. By configuring the code inside the
    TmyDynamicLoadingSubreport, it can load the report template based on the
    band that the subreport is generating inside of. You'll need to create
    regular reports for the header and footer reports. Save these to file as an
    rtm. You'll see in the demo that there is a header file template and a
    footer file template (.rtm). You'll need to create your report, which has
    the dynamic subreports, at runtime, so that you can get the dynamic
    subreport component in the designer.


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited February 2002
    Thank you for the explanation.

    I understood what the example does, just, I didn't get to tie the example my
    need. The example, leaves the user it to set up your report, and I don't
    know if for the example to work for my need I need to give to the user the
    option of setting up the report.

    Today, the reports of examples that I set up " I am evaluating the product
    ", they are written in the following way:

    TFMP99991 = class(TFrmRelPAI)
    ...
    ClntDtStRelPAI: TClientDataSet;
    ppReportTMP: TppReport;
    private
    { Private declarations }
    public
    { Public declarations }
    end;

    procedure TFMP99991.ActnImprimirExecute(Sender: TObject);
    begin
    inherited;

    if (ClntDtStRelPAI.Active) and (not ClntDtStRelPAI.Eof) then
    begin

    ClntDtStRelPAI.First;

    ppReportTMP.DeviceType := 'Screen';
    ppReportTMP.Template.FileName :=
    FMP00001.DiretorioRTM+'\'+Self.Name+'.rtm';
    ppReportTMP.Template.LoadFromFile;
    ppReportTMP.Print;

    end;

    end;


    Thanks.

    Anderson.


  • edited February 2002
    You should run the end user designer, create the reports, and save them down
    as templates. Once you've created all of the reports and when you build the
    exe for deployment, instead of calling ppRegisterComponent, you'll need to
    only register the class. Add myDynamicLoadingSubReport to your uses clause
    on the main form where the report components are located. Place the
    RegisterClass call in the unit where your TmyDynamicLoadingSubReport class
    exists. This will not show the component in the RB runtime designer, but it
    will allow the class to get pulled in so that when the template is streamed
    up into objects, a TmyDynamicLoadingSubReport object can be instantiated.
    The end result is that you get to create the reports with this cool
    component, but you end users cannot, even though they can load one of these
    templates and see it in the designer. Since you are just loading and
    printing templates, then you shouldn't have any problems.

    initialization
    // ppRegisterComponent(TmyDynamicLoadingSubReport, 'Demo Components', 0, 0,
    'Dynamic Loading SubReport', 0);
    RegisterClass(TmyDynamicLoadingSubReport);


    finalization
    // ppUnRegisterComponent(TmyDynamicLoadingSubReport);
    UnRegisterClass(TmyDynamicLoadingSubReport);



    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.