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

Loading Templetes From Database

edited September 2004 in End User
i hav some report format which includes some variables stored in my SQL
Server's table,
the problem i'm facing now is that,
a variable required coding to do calculation, if i remove the variables'
coding error will occur, is it possible to have my variable coding store in
the database as well?

the reason i'm doin this is because, my report component is handling more
than one type of report & tables at the same time, therefore there could be
various variables used in report A, but not in report B.

i heard RAP may solve the problem,
i'm looking for a solution beside RAP.

any suggestion wil be welcome
thanks

Comments

  • edited September 2004
    Hello,

    You are correct in that this problem could easily be solved with RAP. Using
    RAP you could assign specific event code to each variable in your reports
    and keep the code local to the template, rather than residing in your main
    Delphi application.

    The problem with loading templates and using events already created in
    Delphi is that you may loose the event code due to the fact that the
    reference is lost once the template is loaded. See the article below on
    loosing event handlers.

    --------------------------------------------
    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.


    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
This discussion has been closed.