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

Pass parameters to SQL Statement embedded in report

edited November 2001 in General
Hi,

how can I pass a parameter to the sql statement that's embedded in the
report definition.
The reports are stored in the database (enterprise version).

We have certain search criteria that are defined in the query designer, but
we would like to pass the values for those criteria when calling the report.

Thanks,
Bernaert Dominique.

Comments

  • edited November 2001
    Hi Bernaert...

    You can use the AutoSearchFields of RB to set these criteria. From inside
    RAP you can set the criteria in the OnCreate event with
    Report.AutoSearchFields[x].SearchExpression := Value.
    The "x" stands for the position of the AutoSearchFields (where 0 is the
    first). The actual problem is to pass this information into the report. If
    your reports are static and not likely to change in the future, I would
    recommend to set the AutoSearchFields from within Delphi instead from RAP.

    If you need to make this flexible, you could use a similar approach then I
    did. I use a parameter construct in the background. When the report is
    loaded, parameters are added by the report to a list. Now my application
    knows what Values are required by this report (as the parameter name
    identifies the exact input type). I use plugins to let the user select the
    data and each plugin knows which parameter it is responsible for. The user
    makes the selection, the plugins populate the parameters with Values and the
    report fetches these Values in the OnCreate and sets the AutoSearchFields
    before it actually runs. It requires quite a bit of work, but it will pay
    back if you got a lot of new and changing reports.

    Cheers, Marco...
    -------------------------------------------------------------------
    Marco Heine
    QUMAS
    Enterprise Compliance Management
    Visit our Website: www.qumas.com

This discussion has been closed.