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

Templates question

edited April 2003 in General
Hello
I have a report on a datamodule component wich I save as file.
After I'm using the template.loadfromfile method I try
to assing to a ppMemo component from this report some new
text value and I can't figure out how to do it?
Thanks Sorin

Comments

  • edited April 2003
    > I have a report on a datamodule component wich I save as file.

    What code are you using? What problems are you having? Something like:

    ppMemo.Lines.Text :=

    should work.

    Ed Dressel
    Team DM
  • edited April 2003
    Hello Sorin,

    If the ppMemo resides in the report on the delphi form, you can use an event
    handler to assign lines to it. If you are loading a template to the report
    object, you will need to use RAP to update the ppMemo component. RAP is
    included with ReportBuilder Enterprise 7.02.

    -------------------------------
    Article: RAP Overview
    -------------------------------

    Question: What is RAP?


    Overview of Features
    ----------------------

    1. RAP is Portable Code

    RAP allows you to store code with your reports. Until now, ReportBuilder's
    powerful events have been available only within Delphi. If you wanted to
    load reports at runtime and retain any event handlers, you had to load the
    report into a form or datamodule which contained correctly named procedures
    in order to ensure that the loaded report "hooked up" successfully to the
    event handlers. Now, with RAP, you can code your event handlers within the
    Calc workspace and then save them as part of the report in an RTM file. When
    you load a report from an RTM or from a database, your event handlers are
    loaded as well and are already "hooked up".

    2. RAP is EndUser Programming

    RAP allows your users to create their own calculations with their reports.
    ReportBuilder's award winning end user solution was already powerful,
    allowing your users to edit or create new reports, but RAP extends the
    solution by giving end users the ability to code their own event handlers
    and extended calculations. The Calc workspace is an Object Pascal
    development environment that is designed for ease of use by non-developers.
    The Code Explorer offers varied views of the report code module; the Code
    Editor is a syntax-sensitive Pascal editor; the Code Toolbox serves double
    duty, providing both a partial list of supported identifiers as well as a
    drag & drop code creation facility.

    3. RAP is Scalable

    ReportBuilder allows you to scale RAP to the needs of your users. The Calc
    workspace has a great deal of functionality, but your users may not need all
    of it. You are able to limit RAP to those parts you wish to deploy. Using
    the RAPInterface and RAPOptions properties of the Designer component, you
    can specify what features to make available to the end user.

    3. RAP is Object Pascal

    RAP is a subset of Object Pascal so you already know Report Application
    Pascal (RAP) and can easily support your users.

    4. RAP is extensible.

    RAP is extensible. RAP is installed with a large number of standard Delphi
    functions, Delphi objects and RCL (Report Component Library) objects already
    registered with the compiler and Code Toolbox. However, if you wish to
    register your own functions or objects, it is an easy process. Thus you can
    build a library of pass-through functions to deploy with your report
    applications.

    RAP provides a simple, intuitive Pascal development environment. While you
    can use the Calc tab to add code to your reports, it is also made for the
    end user who may or may not have any experience in development environments.
    See the Calc workspace for information about the IDE.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2003
    > What code are you using? What problems are you having? Something like:

    Thanks
    Yes thats the cod I'm using
    "ppMemo.Lines.Text = Form1.Memo.Lines.Text"
    I place this code on the ppReport BeforePrint event.
    When I print the report directly it's work fine but
    when i save the report and use the template.loadfromfile method
    and after that print it the ppMemo component is empty.
    Thanks again
    Sorin
  • edited April 2003
    Hershcu,

    The article below may help you with the problem you are having.

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