Home DADE

Executing SQL statements in Report Builder

edited December 2007 in DADE
Hi, Is there a way to execute SQL statements in Report Builder and use the
result to build code before the report is generated? eg.

variable x := (Select App_Version from ApplicationTable)

if variable_x > 1.04
do some code.
else
do nothing.

Comments

  • edited December 2007
    Hi Andrew,

    At what point in time are you looking to access your dataset? As a general
    rule of thumb, it is not a good idea to access or manipulate your data once
    the report has begun generating. The easiest/most robust way to do this
    would be to access your dataset before the report is printed then execute
    the code based on the data value your receive. Perhaps more information
    about what you are trying to accomplish would help.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2007
    Hi,

    I would like to execute a SQL statement in the beforeopendatapipeline event.

    I've got a report that can be run from 2 different versions of an
    application.

    However, for 1 version, it will execute some code (eg join other tables).
    But for the other version,

    Its not necessary. I have a table in the database that will return the
    version number of the application.

    Basically, I want to perform a select statement to that table to get the
    version number. Then, depending on the

    Version number, execute the code beforeOpenDataPipeline. Is this possible?
    The part I'm having troubles with is to actually

    Execute a select statement and use the result.

    Thanks.

    Andrew

  • edited December 2007
    Hi Andrew,

    ReportBuilder will not execute any SQL code until the report is being
    generated. If you need to execute a query before the report generates, you
    will need to access the datasets directly (perhaps using Delphi components
    such as TQuery, etc.). In order to do this from RAP, you would need to
    create a pass thru function which access the data in Delphi and returns the
    needed value.

    --
    Regards,

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

    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited December 2007
    Sorry, the previous post assumes you are using RAP.

    If you are, take a look at the article below on extending RAP (creating pass
    thru functions etc.). I would suggest getting this working in Delphi first
    regardless then moving the code to RAP if you need.

    --------------------------------------------------
    Article: Extending RAP
    ---------------------------------------------------

    There are two very simple and powerful techniques to extend the capabilities
    of RAP infinitely. These are summarized below and covered in more detail in
    the RAP.hlp online help. Demos and tutorials are installed to
    RBuilder\Demos\RAP. The tutorial text is located in RAP.hlp.


    1. RAP Pass-Through Functions

    These are functions that appear in the Language tab of RAP's Code Toolbox.
    These functions are written in Delphi and can be called from RAP. RAP's
    pass-through function architecture enable's developers to add new built-in
    functions to RAP's code toolbox.

    2. Extend RAP's RTTI

    RAP's Run-time Type information defines what classes and properties can be
    accessed via RAP. By default the published properties of any class that is
    registered with Delphi's RegisterClass procedure is recognized by RAP. In
    addition many of the public properties and methods of ReportBuilder classes
    are exposed.


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