Pass Parameter Values

  • 4 minutes to read

This topic describes 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 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 or stored procedure 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 dashboard parameter in the Value column.

    QueryEditor_PassDashboardParameter

    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. For more information, see Pass Query Parameters.

How to: Pass a Dashboard Parameter to a Custom SQL Query in Code

View Example

This example demonstrates how to create a new dashboard parameter and pass it to a custom SQL query. The dashboard parameter is passed to the custom SQL query parameter's expression. This allows you to dynamically change the query passed to the server.

Filtering

You can use dashboard parameters when you create a filter expression in 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 modes.

To compare a field value with a parameter value, click the Parameters_FilterEditor_CompareButton button and then the Parameters_FilterEditor_CompareButton2 button.

Parameters_FilterEditor

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

View Example

The following example demonstrates how to create a new dashboard parameter and pass it to a dashboard item filter string. The dashboard data source contains two queries - the SalesPerson query is used for data visualization while the Categories query contains values for the dashboard parameter. After the dashboard parameter is created, it is passed to a dashboard item's filter strings and the dashboard displays data according to the selected values.

How to: Use Pivot Grid as a Master Filter Item

View Example

This example demonstrates how to make the Pivot dashboard item behave like a single-select Master Filter item. You can filter other dashboard items by dashboard parameters related to the Pivot Item.

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.

Parameters_EFStoredProcedure

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 expression.

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 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.

ExpressionDialog_PassParameter

How to: Use Dashboard Parameters with the Expression Format Condition

View Example

This example demonstrates how to pass a dashboard parameter to an expression used to apply conditional formatting. You can specify the parameter value to apply formatting dynamically.

Calculated Fields

You can use parameters when you construct 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.

Parameters_CalculatedFields

How to: Pass a Dashboard Parameter to a Calculated Field's Expression in Code

View Example

The following example demonstrates how to create a new dashboard parameter and pass it to a calculated field's expression:

Window Calculations

Use parameters to dynamically apply a calculation based on the current parameter value when you customize expressions for window calculations.

PassingParameters_WindowCalculation

See Also