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

5. Dynamic Subreport Loading demo - RB7/D6

edited October 2002 in Subreports
In a thread from 2002/07/12 (Dynamic Loading Subreports from a
database) a problem with this demo was acknowledged for 6.03. I have
now upgraded to 7 and I still get it.

I wish to use this feature - is there a patch available?

Thanks,
Rick Matthews
Dartek Systems Inc.

Comments

  • edited October 2002
    The problem is that the current folder id value in the report explorer is
    not the same as the one where the template is located. Thus, when the report
    explorer tries to load the template, it fails because it assumes that it is
    located in correct folder. What you can do is tell the report explorer not
    to load the template, since it relies on the folder id, and let the template
    locate the report template from the item pipeline using the entire item
    dataset.

    When the subreport template is loaded in the TmyDynamicLoadingSubreport
    methods, temporarily nil out the method pointer for reOnLocateRecord on the
    template and then make the call to LoadFromDatabase.

    var
    ...
    lSavedReportExplorerEventHandler: TppLocateEvent;
    begin
    ...
    lSavedReportExplorerEventHandler := Report.Template.reOnLocateRecord;
    Report.Template.reOnLocateRecord := nil;
    Report.Template.LoadFromDatabase;
    Report.Template.reOnLocateRecord := lSavedReportExplorerEventHandler;
    ...

    Thanks for reporting the issue and sorry it wasn't included in the latest
    release.


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited October 2002
    Thanks Jim that worked a treat but it lead to another error.

    I put the code in the LoadFooterSubreport proc, opened the report,
    switched to the dynamic footer template tab and then clicked preview.

    This time it did find the template and ran correctly.

    I then clicked close and I get an AV in:

    procedure TppRuler.ClearGuides;
    begin

    {erase current guide}
    DrawGuide(FGuide1X, FGuide1Y); <== here


    Thanks,

  • edited October 2002
    Ouch, it worked in tests here. I'll see if I can reproduce it. The dynamic
    loading of a subreport template while the main report is generating is
    definitely pushing the envelope. I'll post the results of our findings here.


    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.