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

Reports in Databse and their events.

edited April 2006 in General
Delphi 6 + IB 6.0x + RB 7.0

I have all my reports saved in a databse table.
At run time I create a ppReport component then load the selected report from
table and print it.
This works fine as far as I do not have any events for any of the components
inside the report, I mean like OnCalc of a ppVariable.

For this sort of reports I already have ppReport inside the form, with a
whole heap of components which is needed for the events, and then I load the
report
into this ppReport component and print them and it works fine. It goes
something like this.

procedure TForm1.ppVariable1Print(Sender: TObject);
begin
if ReportName = 'REPORT-1' then
ppVariable1.Value := ppVariable1.Value +
ppDBCalc1.Value-ppDBCalc2.Value;

if ReportName = 'REPORT-2' then
ppVariable1.Value := ppVariable1.Value -1000;
end;

What I need and want to do is to do away with the ppReport component in the
form, and always create the ppReport and load the Report from the table.

How am I going to Create events, use various variables etc inside each of
these reports for calculation ?

Thanks in Advance

Thatchi
~~~~~~~~~~~~~~~~~~

Comments

  • edited April 2006
    Hi Thatchi,

    The solution is to keep all your report events local to the template file
    using RAP. RAP is available with the Enterprise edition of ReportBuilder.

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


    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited April 2006
    Thanks Nico !

    Im working on it with RAP. One problem I have declared a Global variable in
    RAP. How can I set a value for this variable from Delphi unit, I mean
    outside RAP ?

    Thanks

    Thatchi !
    ~~~~~~~~~~


  • edited April 2006
    Hi Thatchi,

    Take a look at the Report.Parameters feature. You can assign parameter
    values in Delphi and use them in RAP. See the following example.

    http://www.digital-metaphors.com/tips/SimpleParameters.zip

    --
    Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com

    Best Regards,

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