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

Sub Report loaded dynamically

edited January 2003 in Subreports
I am currently using Delphi 6 and Report Builder version 6.02.

I have a report that has 2 sub-reports for labels. Based on the type of
barcode required, I am loading the sub-reports dynamically from
Template.LoadFromFile on the report property of the sub-reports.

The problem occurs when printing the report both of the sub-reports are on a
second page. If I print the report without attempting to load from a
template, the sub reports are in the detailed section of the master report
in the appropriate location on 1 page.

Do you have any suggestions as to what may be wrong or a possible fix?

thanks
bob west

Comments

  • edited January 2003
    Loading templates is not recommended while the report is running. However,
    we have a demo which does this (DynamicSubreportLoading) however, it doesn't
    support this in the detail band, only for headers, footers and titlebands.
    You may have to call this after loading the template:

    Subreport.Report.Engine.State := Report.Engine.State - [esInitialized];
    Subreport.Init;

    Still, loading of templates is not recommended, because there is a
    cachemanager which handles caching of all the calc components values as the
    report genreates. Changing the footprint while it generates could cause a
    problem.

    The best alternative is to use separate subreports and change their
    visibility as the report generates if you want to show a different detail
    template report.

    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.