How to: Use Dashboard Parameters with the Expression Format Condition
- 3 minutes to read
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.
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 dashboard parameter that allows you to specify the required numeric value.
- Pass the created parameter to the expression of the format condition.
Create a Parameter
To create a dashboard parameter, click the Parameters button in the Home ribbon tab.
In the invoked dialog, click Add to create a new parameter…
…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.
This invokes the Expression dialog.
Make sure that the Extended Price measure is selected in a created condition. Then, select the Is greater than criteria operator from the list.
Click the button next to the <enter a value> operand value, then click the button. The discountValue will be selected as an operand value (note that the icon will be displayed next to the selected parameter).
Finally, select the Pale Green color in the Appearance tab and click OK.
Extended Price cells corresponding to values more than the default parameter value (150000) will be filled with a pale green color.
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.
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.