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

New User Question

edited April 2002 in General
Hello,

I would like to know if what I am attempting to do is appropriate. In this
way, I hope to better understand the integration of a ReportBuilder report
and a Delphi form, as well as solve this issue.

I have developed a ReportBuilder report in a Delphi application and saved
the report template. I then started another new application and dropped a
ppReport component on the form. I rename the ppReport to the name in the
first application.

I double-click the report component. I then try to open the report template
I previously created using the report component File|Open command in the new
application. I receive an Error Reading Template dialog. It states Error
reading ppReport1.OnPreviewFormCreate: Invalid property value. If I ignore
this I receive an additional error involving a labels OnPrint event. The
thing is, there is no ppReport1 object on the form, and the report object on
the original form has been renamed before saving the template. Am I
proceeding incorrectly, or is this a problem with the template file?

Thanks very much,
Mike Malinowski

Comments

  • edited April 2002
    The information below should be helpful.

    --------------------------------------------
    Article: Troubleshooting Lost Event Handlers
    --------------------------------------------

    Let's assume you have created a report in Delphi and assign an event
    handlers to the OnPreviewFormCreate event of the report. The event is
    generated by Delphi as:

    procedure TForm1.ppReport1PreviewFormCreate(Sender: TObject);

    You then save the report to an RTM file 'Report1.RTM.' The events are
    stored as references only, and so the RTM contains:

    object ppReport1: TppReport
    .
    .
    OnPreviewFormCreate = ppReport1PreviewFormCreate
    end

    You then go on to work on a different report. Saving it with under then
    name 'Report2.RTM'. Only this time, before you save the report you change
    the report component name to: rptOrders. Delphi automatically updates the
    event declaration for OnPreviewFormCreate event to:

    procedure TForm1.rptOrdersPreviewFormCreate(Sender: TObject);


    You then create two buttons on the form, one to load Report1 and preview,
    the other to load Report2 and preview. When you run the app and click
    Report1, you an error. This is because the Report1.RTM file contains a
    reference to ppReport1PreviewFormCreate, a method which no longer exists (at
    least with this name) in the form.

    One answer is to load all your rtm files into the report component you will
    be using for loading. Fix any errors, reassign any events that get cleared.
    This will update your rtms to contain the proper event handler names.

    --
    Cheers,

    Alexander Kramnik
    Digital Metaphors

This discussion has been closed.