Report Parameter Fundamentals

Report Parameters are very useful in allowing users to modify information and aspects of a report from outside the report itself.  Report Parameters can also be used to manually create search criteria and search lists in conjunction with the AutoSearch feature of ReportBuilder.

Creating Parameters

Parameters are added to the report using the Report Tree.  Enable the Report Tree by selecting the View | Toolbars | Report Tree main menu option in the designer.  Near the top just under the Report object, you will see a “Parameters” icon.  Right click this and select “New” to create a new parameter.  A new parameter icon should now appear.  Select this icon to view the parameter properties in the Report Object Inspector (below the Report Tree).  Some important properties are described below.

TppParameter.LookupList:  Manually create a list of values to be used as the parameter value inside the report.

TppParameter.LookupSettings: Allows the user to define a field inside a “lookup” dataset to be used as a list of values.

TppParameter.AutoSearchSettings: When enabled, adds the parameter to the AutoSearch architecture of ReportBuilder allow users to search based on the parameter value.  If a list of values is defined, a combo box will automatically be created inside the AutoSearch dialog displaying all values in the list.

Using Parameters with AutoSearch

Follow the steps below to properly link a Report Parameter with the ReportBuilder AutoSearch architecture.

1. Create a parameter following the instructions above.

2. In the Data Workspace (Data Tab) create a dataview to be used with the report.  This query should contain at least one search condition.  Do so by selecting the magnifying glass in the toolbar of the dataview and double clicking a field to search on.

3. Link the search condition to the parameter by clicking the parameter combo box and selecting the proper parameter.

4. Return to the Designer (Design tab) and set the TppParameter.AutoSearchSettings.Enabled property to True.

The following example shows how this is to be done.  It also defines a “lookup” dataset to populate the list of possible values the parameter might have.

ParameterLookupList.zip

Using Parameters with RAP

Follow the steps below to use Report Parameters in RAP code.

1. Create a parameter following the instructions above.

2. From outside the report (in Delphi code) or from within the designer give the TppParameter.Value property a value.

3. Inside RAP, the parameter value can now be accessed using the Report.Parameters property.

lParameterValue := Report.Parameters[‘MyParameter’];

See the following example for a demonstration of the instructions above.

SimpleParameters.zip