Passing Parameter Values
- 4 minutes to read
In this topic, you learn how to pass the created dashboard parameter to a dashboard. For instance, you can include a dashboard parameter in a WHERE clause of the SQL query or dynamically filter a dashboard according to the required parameter value(s).
The created dashboard parameter can be used in the following scenarios:
- SQL Queries
- Filtering
- EF Data Source - Stored Procedures
- Conditional Formatting
- Calculated Fields
- Window Calculations
SQL Queries
The Dashboard Designer allows you to bind a dashboard parameter and the existing SQL query/stored procedure parameter. This can be useful when you need to filter the SQL query dynamically by including the parameter value in the WHERE clause.
The steps below shows how to bind a dashboard parameter to an SQL query/stored procedure parameter in the Data Source wizard or Query Editor:
- Create a new query parameter or select the existing query/stored procedure parameter.
Enable the Expression check box for this parameter and select the required dashboard parameter in the Value column.
The dashboard and query parameters are bound. You can select Expression editor… and specify an expression to bind a query parameter to a dashboard parameter with custom logic. To learn more, see Pass Query Parameters.
How to: Pass a Dashboard Parameter to a Custom SQL Query in Code
Filtering
You can filter the specified query of the SQL Data Source, the entire Excel Data Source/Object Data Source/Extract Data Source or apply filtering to a specific dashboard item according to the current parameter value(s) using the Filter Editor.
In the Filter Editor, you can compare a field value with different objects such as static values, values of another field, or parameter values. Use the button placed next to the operand value to switch between these modes.
- A static value (the icon is displayed next to the operand value). Click the button to switch to the next mode (“another field value”) to compare the field value with another field value.
- Another field value (the icon is displayed next to the operand value). Click the button to switch to the next mode (“parameter value”) to compare the field value with a parameter value.
- A parameter value (the icon is displayed next to the operand value). Click the button to switch back to the initial mode (“static value”) to compare the field value with a static value.
To compare a field value with a parameter value, click the button and then the button.
Then, click the operand value to invoke the list of available parameters and select the required parameter.
How to: Pass a Dashboard Parameter to a Filter String in Code
EF Data Source - Stored Procedures
You can pass an existing dashboard parameter to use it as a stored procedure parameter if you use a stored procedure from the Entity Framework Data Source.
To do this, enable the Expression check box and select the required dashboard parameter from the invoked combo box. You can also use the Expression Editor to specify the required expression.
Conditional Formatting
You can apply conditional formatting to a specific dashboard item according to the current parameter value when creating the Expression format condition. You can use this capability to dynamically format dashboard item elements depending on the current parameter value. In the Expression dialog, you can compare a field value with parameter values in the same manner as in the Filter Editor dialog.
How to: Use Dashboard Parameters with the Expression Format Condition
Calculated Fields
You can use parameters when constructing expressions for calculated fields. This allows you to dynamically evaluate values of the calculated field depending on the current parameter value.
To include the required parameter in the calculated field expression, click Parameters in the Expression Editor dialog and double-click the required parameter.
How to: Pass a Dashboard Parameter to a Calculated Field’s Expression in Code
Window Calculations
You can use parameters when customizing expressions for window calculations. This allows you to dynamically apply a calculation depending on the current parameter value.