The checkbox list parameter allows a report consumer to choose multiple options
In addition to the to the common attributes available to all parameter types the following additional attributes are available:
- Is Value Required
- Defines whether a user must choose an option before executing the report. Click here to read more about the "Is Value Required" attribute.
- Datasource Query
- TIP: Pressing the F-11 key the cursor is in the Datasource Query textbox will enlarge the editor area, press F-11 again to return to the default view.
- Specifies the values that will be shown in the checkbox list. Two methods are available to specify the available items:
- SQL Query: Use a SQL query and only return (2) columns, Id and Name. The Id will be used as the value passed to the report query and Name will be used as the display text shown to the user. You can also also return an optional "IsSelected" column to specify the checked/unchecked status of a checkbox
-
Static List: You can also specify parameters statically by supplying a comma seperated list of key value pairs as in the following example:
- Using the format of: Name:Id
- This is the first option : 1, This is the second option : 2, This is the third option : 3
- Example shown below:
Usage in SQL Command Text
A table variable will be declared in the auto-generated section and can be used as a standard SQL table variable. In the below example a checkbox list parameter with a programmatic name of "BookFormatTypes" has been added to the report and is utilized within the SQL to search for all books every book format type specified by the report consumer
The generated SQL when executing a report containing a checkbox list parameter type is shown below. Note that a table variable with a single Id column is created and then populated with an INSERT statement with whatever options the report consumer selected :
One more parameter is also provided so that results can be altered based on the state of the report as shown below.
- FirstTimeload
- First time the report is loaded, prior to the report being executed
- RefreshParameters
- Control is refreshing due to cascading
- Execute
- Control is loading after report has been executed
Parent-Child Reports
If the control is hosted on a child report parameters will also be available from the parent in the same manner the child report query itself. Click here to learn more about parent-child report variables.