This video shows how to use dashboard parameters to perform different analytical tasks.
For instance, you can use parameters to filter the dashboard dynamically or you can highlight
values using parameters along with the conditional formatting feature.
I already have a dashboard that's connected to a database.
It has a Grid displaying three columns: Category, Product and Extended Price.
Let’s filter the Grid by category using a dashboard parameter.
Click the Parameter button in the Home ribbon tab and then click Add.
Change the parameter name to ‘Category’, then, specify its description.
Leave the default value for the Look-Up Settings option (No Lookup).
We'll use a string parameter.
Finally, specify the default parameter value as ‘Beverages’.
Now we're ready to filter the grid with the parameter.
To do this, right-click the Grid and select Edit Filter.
Here we'll add a new condition, change the criteria operator to ‘Equals’ and click
the button next to the ‘enter a value’ placeholder two times.
This allows you to compare field values with the parameter value.
Click OK to see that the Grid will be filtered according to the default category – ‘Beverages’.
To change the current parameter value, click the Parameters button in the dashboard title
and specify a value.
For us, it'll be ‘Condiments’.
Click Submit to see the result.
If you want, you can allow end-users to select predefined values.
Go to Parameters and change Look-Up Settings to Static List.
Then, click the ellipsis button next to Values and add the required categories, one per line.
Click OK.
You can now select the default predefined value from the list here.
The Dashboard Parameters dialog allows end-users to select the required category from the dropdown.
Let’s look at a more complicated scenario where category values are stored in a database.
Go to the Data Source ribbon tab and click Add Query.
In the Query Editor, click the Run Query Builder button and drop the ‘Categories’ table
to the empty area.
Enable the All Columns check box and click OK.
Then, click Finish to complete creating of a new query.
Go to the Home tab and open the Parameters dialog again.
Change Look-Up Settings to Dynamic List and select the SQL Data Source 1 as a data source
providing parameter values.
Then, select the newly created query (‘Categories’) as a Data Member.
Finally, select the CategoryName field as a Value Member.
You can see the Value option allows you to select any category value available in a database.
Change the default value and click OK to see the result.
The Dashboard Parameters dialog allows end-users select any category value available in a database.
The Dashboard not only allows you to select a single parameter value, but provides the
capability to enable multi-selection as well.
Go to Parameters and set Allow Multiselect to Yes.
Click OK.
You can see that the Grid shows the error in its caption because multi-select parameters
cannot be used with the ‘Equals’ criteria operator.
Click Edit Filter and change the operator to ‘Is any of’.
The Grid will be filtered correctly now.
Click the Parameters button in the title and select some parameter values.
Add a chart and bind it to the Extended Price,
CategoryName and OrderDate fields.
Let’s say we want to filter the entire dashboard using the current parameters values.
In this case, you can pass a parameters to a data source’s filter string.
Clear the filter applied to the Grid and go to the Data Source tab.
Click the Filter button in the Query group to apply filtering to the SalesPerson query.
In the data source’s Filter Editor, select the CategoryName field, choose the ‘is any
of’ operator and click the button next to the operator and value two times.
Then click the ‘select a parameter’ placeholder.
Select Bind To in the popup and select the Category parameter.
Then, click OK.
You can now filter the entire dashboard by selecting the required parameter values.
Note that the data source is filtered using the dashboard parameters not directly but
using the intermediate query parameter.
Click the Edit button.
You can see that the data source is filtered using the WHERE clause included to the SQL
statement.
The Category query parameter is used along with the IN operator.
On the next page, you can see that the Category query parameter is bound to the corresponding
dashboard parameter.
Dashboard parameters can be used along with other dashboard features such as calculated
fields or conditional formatting.
Remove Chart, clear the data source filter and delete the query parameter.
Then, remove the Category dashboard parameter and click Add to add a new parameter.
Change its name to PriceThreshold, set its type to Number (decimal) and specify the default
value as 10000.
Click OK.
To create a new calculated field, right click the field list and select Add Calculated Field.
Specify the expression using the if function that will return True or False depending on
whether or not the Extended Price summary value exceeds the parameter value.
Click OK and drop the calculated field to the Grid.
You can now change the current parameter value to see the result.
[For instance, the Grid shows False for 12300 because this values less than 15000.]
Let’s use the created parameter to highlight cells whose values exceed the parameter value.
Click the Extended Price menu button and select Add Format Rule | Expression.
Then, specify the expression, select the required color for highlighting values and click OK.
As always, change the parameter value to see changes.
That's it for this video, to learn more about our Dashboards, make sure to check out the
documentation on our website.
Thanks for watching, and thank you for choosing devexpress.