ActiveReports 9
Parameters
Show AllShow All
Hide AllHide All

ActiveReports allows you to use parameters to filter or add the data to display in reports at runtime. You can either prompt users for parameters so that they control the output, or supply the parameters behind the scenes.

Adding parameter for different data sources

A query parameter can get its value from the Report Parameters collection (entered by the user or from a value you supply), a field in another dataset, or an expression. Syntax for adding a parameter in your query might differ depending upon the data source that you are using. Use the syntax specific to your data source type to create a parameter.

Parameterized query for different data sources are as follows:

Data Source Parameter Syntax Example
OleDB (?) SELECT * FROM Customer WHERE (CustomerID = ? AND AccountNumber = ?)
ODBC @ParameterName SELECT * FROM Customer WHERE (CustomerID = @CustomerID AND AccountNumber = @AccountNumber)
SQL Client @ParameterName SELECT * FROM Customer WHERE (CustomerID = @CustomerID AND AccountNumber = @AccountNumber)
OracleDB :ParameterName SELECT * FROM Customer WHERE CustomerID = :CustomerID AND AccountNumber = :AccountNumber

Page Report/RDL Report

In a page report or a RDL report, the easiest way to build queries with parameters is to use the Visual Query Designer, as it automatically sets up each parameter.
In the DataSet dialog, click on to access Visual Query Designer for creating SQL queries. See Query Building With Visual Query Designer for further information on how to create a parameterized query using the interactive query designer.

However, if you would like to do it manually, you must enter each parameter in three locations: the Report Parameters dialog (for filtering data at run time), the Parameters page of the DataSet dialog, and the Query page of the DataSet dialog.

Report - Parameters dialog

Parameters page of the DataSet dialog

Query page of the DataSet dialog

If you want to run a report without prompting the user for a value at runtime, you need to set a default value for each parameter and the Hidden check box should be selected in the Report - Parameters dialog, General tab.

Subreport parameters are also considered as hidden parameters as a user can easily synchronize a subreport's data with that of the parent report . See Subreports in RDL Reports for further details.

Drill-Through parameters are also hidden parameters as drill-through links are used to navigate from one report to another. When you select Jump to report for the action, the parameters list is enabled.

Section Report

In section report, you can use the Parameters collection to pass values directly into a control at runtime, or you can also use it to display a subset of data in a particular instance of a report.

There are several ways for setting up parameters in a report:

Prompting for Parameter Values

Adding Parameters to the Parameters Collection via the SQL Query

See Also

 

 


Copyright © 2016 GrapeCity, inc. All rights reserved

Support Forum