Pass Parameter Values
- 3 minutes to read
This topic describes how to pass the created dashboard parameter to the dashboard. For instance, you can include a dashboard parameter to a WHERE clause of the SQL query or you can filter a dashboard dynamically according to the required parameter value(s).
The created dashboard parameter can be used in the scenarios below.
Security Consideration
A user can get sensitive information from dashboard parameters. Encode the passed parameter value if possible. Do not store any sensitive information in dashboard parameters that isn’t encrypted.
SQL Queries
You can filter the SQL query dynamically if you pass a dashboard parameter to an SQL query or stored procedure. The resulted query has the WHERE clause that contains a parameter bound to the dashboard parameter value.
Follow the steps below to include a dashboard parameter in an SQL query/stored procedure in the Dashboard Data Source Wizard:
- Select the query/stored procedure parameter or click the Add button to create a new query parameter.
- Set the parameter type to Expression and click the ellipsis button to invoke the Expression Editor.
- In the Expression Editor, add the dashboard parameter from the Parameters column.
Refer to the following help topic for more information about query parameters: Pass Query Parameters.
The following example shows how to override an initial or user-defined dashboard parameter value by changing it in the ASPxDashboard.CustomParameters event handler:
Filtering
You can use dashboard parameters when you create a filter expression in the Filter Editor. Click a down arrow glyph in the operand value placeholder to expand the list of available objects and switch between values. Select the Parameter object to compare a field value with a parameter value.
Then, click the operand value to invoke the list of available parameters and select the existing parameter or create a new one.
This example illustrates how to pass filter values to a parameter:
Conditional Formatting
You can apply conditional formatting to a specific dashboard item according to the current parameter value when you create the Expression format condition. It allows you to format dashboard item elements dynamically, depending on the current parameter value.
To switch between values, click the down arrow glyph in the operand value placeholder. This action expands a list of available objects and allows you to select the Parameter object and create a format rule with a parameter.
Calculated Fields
You can use parameters when you construct expressions for calculated fields. This allows you to evaluate values of the calculated field dynamically depending on the current parameter value.
To include a parameter in the expression, double-click the required parameter in the Fields pane.
Window Calculations
Use parameters to dynamically apply a calculation depending on the current parameter value when you customize expressions for window calculations.
To create the calculation with a parameter, select the Custom calculation and click Edit. In the invoked Expression Editor double-click the required parameter.
Update a Dashboard or a Dashboard Item
The example shows how to use dashboard parameters to update a specific dashboard item without refreshing the entire dashboard: