Home General

event on multiple .rtm files in a report

edited July 2001 in General
Hi, I use a single ppReport to produce multiple reports,
what I did was design in the same ppReport and save to different .rtm files.
At runtime my apps will dynamically load the .rtm files depand on user
selections,
examples as follows..
...
Case Option of
1: ppReport1.Template.FileName:= 'MyRpt1.rtm';
2: ppReport1.Template.FileName:= 'MyRp2.rtm';
3: ppReport1.Template.FileName:= 'MyRp3.rtm';
end;
ppReport1.Template.Load;
ppReport1.PrintReport;

It works fine. BUT if I were to define an event say, ppLabel1.OnGetText for
MyRpt1 I will get error on another report say MyRpt2.rtm if MyRpr2.rtm does
not have ppLabel1.

How can I over come this "without adding additional TppReport to my form".

Thank In Advance
Regards
Hott

Comments

  • edited July 2001
    Order ReportBuilder Enterprise, use RAP event handlers, and your problem
    will be solved. The event handlers will be stored inside of the report
    definition.


    Cheers,

    Jim Bennett
    Digital Metaphors


  • edited July 2001
    Jim,
    For your Information, I am using ReportBuilder Enterprise Edition version
    5.56 (LEGALLY), and about to download 6.0 Its just the matter or time
    because of the file size (12 MB).
    How can you make assumption that I am not using Enterprise Edition? I am
    glad and optimis, you tell me that the porblem WILL be solved with RAP. But
    how? I can't find any good sample or tutorial on RAP. I dont even know where
    to start. I will appreciate if you can show me the initial steps by using
    the example I've posted.

    Regards
    Hott.

  • edited July 2001
    Thanks for already being a (legal) Enterprise user. Apologies for my
    assumption. You may not absolutely need RAP, but it sure can make life
    easier when facing a problem such as this. I was only trying to say that RAP
    allows you to code event handlers and save them inside of the rtm. Plus,
    when your customer tells you that a calculation for a report should be
    different, you can simply resupply the customer with a new report template,
    if the event handler is in RAP. You don't have to recompile your app, like
    you would if the event handler was coded in an event handler on a form. This
    is why I try to reccomend using RAP if at all possible.

    Before RAP, our first solution to this problem was to use one form for every
    report. This way, the report specific event handlers are located with the
    proper report component. See the main reports demo project in your RBuilder
    installation directory for an example.

    When RAP was released, it let you use only a single form and one report
    component to load any and all report templates in your application. DADE
    allows you to store the data access information in the rtm, and RAP let you
    store the event handlers and calculations within the rtm as well. There are
    RAP demos and Tutorials in the RBuilder installation. Also, there is a
    Templates thread in the Tech-Tips newsgroup which has some good information
    on using template events. If common even handlers should be assigned to the
    report component, in order to avoid having the same event handler in every
    report. One such case is the maximizing the preview in the
    OnPreviewForCreate event which is covered in the tech-tips.

    Open up the report templates in the designer and create RAP event handlers
    just like you had in the form unit. Then remove the form unit event handlers
    and just load the templates like your are doing and call Report.Print.


    Cheers,

    Jim Bennett
    Digital Metaphors


This discussion has been closed.