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

Using multiple rtm templates problem

edited May 2002 in General
In one of my forms of my application I am using multiple files templates.
Depending on what is displayed a certain report template will be loaded and
run using the following code snippet. The problem I seem to be having is
that when I run an initial report using one template and then later run a
different template and then close the application I get an invalid pointer
operation error. As long as I don't load and run a different template report
I do not get the error. Am I missing something here?

Application.ProcessMessages;
try
PropBkDB.DisableControls;
CustFormDB.Active := True;
if CustFormDB.Locate('FormNumber', 8, []) then
begin
ppReport1.Reset;
ppReport1.Template.New;
ppReport1.Template.FileName := FPathName + 'pbkitem.rtm';
ppReport1.Template.LoadFromFile;
ppReport1.DeviceType := dtScreen;
ppReport1.Print;
end;
finally
PropBkDB.EnableControls;
Application.ProcessMessages;
CustFormDB.Active := False;
end;
end;

I am using Delphi 5.0, FlashFiler 2.10 and WindowsXP Pro on my machine. Any
help would be appreciated.

Regards;

Bob Dalton

Comments

  • edited May 2002
    Dear All,

    I downloaded RB recently, and and since most of my previous
    reports are done in QuickReports, I have some difficulties
    understanding ReportBuilder's approach to certain tasks.

    Here's one for starter...

    In QR, since the report is tied to the form, we can create
    a hierarchy of reports piggybacking Delphi's Visual Form
    Inheritance mechanism. What this means is that I can start
    with a basic report that contains only several components
    for the headers and footers (Report titles, user name,
    printing timestamp, page number), and apply generic
    formatting (font colors, etc). This is the highest-level
    ancestor.

    All other reports will INHERIT from this report/form, so
    they will inherit all the components/properties of the
    ancestor. Each children will 'override' some components
    (report title, dbtexts in the detail band, etc) if needed.

    This way, whenever a sweeping change is required, I can
    just open the ancestor form/report, change the properties,
    and all the children's inherited components will change
    accordingly.

    How do we accomplish the same thing with ReportBuilder?

    The obvious answer would be just like QuickReport,
    putting each ppReport Component inside a form in itself,
    inheriting the form each time I need a new form.

    But since ReportBuilder doesn't really NEED a form, I have
    a feeling that I'm missing something. Not to mention that
    the scheme will probably lose me the ability to use
    templates (RTM?).

    As far as I can understand from the documentations, report
    persistence in RB is accomplished by three pieces of
    technology: RTMs, DADE, and RAP. DADE allows one to store
    queries, etc inside a report, and RAP allows one to store
    logic code inside a report. RTM provides a way to store
    the report in a file or database.

    To rephrase my earlier question, let's assume that I have
    10 reports stored in RTM format on file. How do I make sure
    that the ten reports will have exactly the same HEADERs and
    FOOTERs for example?

    I have a lot of legacy QR reports relying on this behaviour,
    and converting them one by one is error prone and tedious.
    I have not seen this mentioned anywhere in the documentation,
    so I thought I'd just ask. Sorry for the long winded email.

    Thanks in advance...
    sugi.

    PS: please cc my email, i may not be able to follow the
    newsgroups closely. thank you.
  • edited May 2002
    You cannot mix form inheritance and report templates. We recommend using
    report templates and then use subreports to load templates which have the
    header and footer common bands. There is an example of this approach in the
    dynamic subreport laoding example in the RBuilder\Demos\EndUser\Dynamic
    Subreport Loading. The subreports in the header/footer bands can load a
    tempalte. You can do this for all of your reports. Then when it comes time
    to change the header and footer, you can do so by loading the header/footer
    report template.


    Cheers,

    Jim Bennett
    Digital Metaphors

  • edited May 2002
    Try breaking out the template loading into a simple test application which
    just runs you reports with a single report component on a form. We have no
    problems here loading different templates. Please send us an example project
    which reproduces the problem to support@digital-metaphors.com

    Cheers,

    Jim Bennett
    Digital Metaphors

This discussion has been closed.