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 following scenarios:
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.
ASPxDashboard - How to: Pass a Hidden Dashboard Parameter to a Custom SQL Query
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.
ASPxDashboard - How to: Update the Parameter Value When the Item’s Master Filter State is Changed
This example illustrates how to pass filter values to a parameter. You should specify the initial master filter state when you load the page. To obtain changed master filter values, handle the ASPxClientDashboard.ItemMasterFilterStateChanged event. Use the ASPxClientDashboard.GetParameters method to pass these values to the dashboard parameter. To assign default master filter values, use the Dashboard State.
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.