Multi-value Parameter
123
For creating a multi-value parameter, check the multi-value
lue 'select all' is replaced with the 'select all' value specified in parameter
on previewing report.
Value required icon appears if 'select all' option is unchecked and no value is selected for parameter.
If you want to run a report without prompting the user for a value at run time, you need to set a default value for each parameter. The report collects the required parameter value from the default value and uses it to generate the report.
Default values can be queried or non-queried. A non-queried default value can be a static value or an expression. A queried default value is a field value from a dataset.
Use the following instructions to create your own hidden parameters. These steps assume that you have added a Page Report/RDL Report template to your report and have a data connection in place. See Adding an ActiveReport to a Project and Connect to a Data Source for further information. Also refer to Add a Dataset before reading this topic.
Note: This topic uses the DVDStock table in the Reels database. By default, in ActiveReports, the Nwind.mdb file is located at [User Documents folder]\GrapeCity Samples\ActiveReports 12\Data folder.
- In the Report Explorer, right-click the Parameters node and select Add Parameter.
- In the Report - Parameters dialog that appears, add a parameter named ProductName with String data type.
- Enter Text for prompting users for a value.
- On the Default Values tab, select Non-queried and click the Add(+) icon to add an empty expression for the value.
Note: When you use From query to provide a default value, only the first returned row value is used as the default value.
- In the Value field enter 5 and click OK to close the Report - Parameters dialog.
Note: When adding multiple default values, in the Report - Parameters dialog, General tab, check the Multivalue check box, otherwise the report collects only the first default value from the list and uses it to generate the report.
- In the Report Explorer, right-click Data Source (DataSource1 by default) node and select Add Data Set to create a dataset.
- In the DataSet Dialog that appears, on the Parameters page, click the Add(+) icon to add an empty expression for the parameter.
- In the Name field, enter the same parameter name (StorePrice) you had added in the steps above and set its value to:
=Parameters!StorePrice.Value
- On the Query page of the DataSet Dialog, use the following SQL query to fetch data from the DvDStock table.
SELECT * FROM DvDStock WHERE StorePrice IN (?)
.
- From the Visual Studio toolbox, drag and drop a Table data region (or any other data region) onto the , and from the Report Explorer, drag the Title, StorePrice and In Stock fields onto the row.
- Click the to view the result.
Notice that the report collects the required parameter value from the default value (i.e. 5) and uses it to display the list of Movie DVDs with Store Price $5.