How to: Use Dashboard Parameters with the Expression Format Condition

This tutorial demonstrates how to use a dashboard parameter with the Expression format condition when applying formatting dynamically.

The DevExpress dashboard is already connected to the SalesPerson view of the Northwind database. The Grid dashboard item is bound to the Sales Person and Extended Price fields. Note that the Sales Person column is sorted by the values of the Extended Price column in descending order.

ParameterExpressionTutorial_SampleGrid

Suppose that you want to format Extended Price cells whose values exceed the predefined parameter value. To do this, perform the following steps.

Create a Parameter

To create a dashboard parameter, click the Parameters button in the Home ribbon tab.

Parameters_AddParameterButton_Ribbon

In the invoked dialog, click Add to create a new parameter...

ParameterExpressionTutorial_ParametersDialog

...and specify its settings in the following way.

  • Specify the following Description that will be displayed in the Dashboard Parameters dialog: Format values that are greater than.
  • Change the parameter's Type to Number (decimal).
  • Specify the default parameter Value as 150000.
  • Finally, change the parameter Name to priceParameter.

Click OK to create the dashboard parameter.

Pass the Parameter to a Calculated Field's Expression

To pass the created parameter to the Expression format condition, click the menu button of the Extended Price measure, go to Add Format Rule and select Expression from the sub-menu.

ParameterExpressionTutorial_MeasureMenu

This invokes the Expression dialog.

ParameterExpressionTutorial_ExpressionDialog

Make sure that the Extended Price measure is selected in a created condition. Then, select the Is greater than criteria operator from the list.

ParameterExpressionTutorial_ExpressionCriteriaOperator

Click the Parameters_FilterEditor_CompareButton button next to the <enter a value> operand value, then click the Parameters_FilterEditor_CompareButton2 button. The discountValue will be selected as an operand value (note that the Parameters_FilterEditor_CompareButton3 icon will be displayed next to the selected parameter).

ParameterExpressionTutorial_ExpressionSelectParameter

Finally, select the Pale Green color in the Appearance tab and click OK.

ParameterExpressionTutorial_ExpressionClickOK

Extended Price cells corresponding to values more than the default parameter value (150000) will be filled with a pale green color.

ParameterExpressionTutorial_Result1

You can apply formatting dynamically by changing the parameter value in the Dashboard Parameters dialog. To invoke this dialog, click the Parameters button in the dashboard title.

ParameterExpressionTutorial_ChangeParameterValue

Specify a new value (200000) in the Value column and click the Submit button. Extended Price cells corresponding to values more than 200000 will be filled with a pale green.

ParameterExpressionTutorial_Result2

See Also