Custom interactive filter examples
-
- UpdatedAug 3, 2023
- 6 minutes to read
- Vancouver
- Dashboards
As an administrator, you can create custom interactive filter widgets to provide advanced filtering options on dashboards.
Use case
This example details how to create a custom filter to filter reports on the Task table, or its child tables. The filter only shows records where the current user is the caller. The filter exposes two buttons to the user, one button to add the filter and one to remove the filter.
Create a custom interactive filter widget
Create custom interactive filter widgets to provide advanced filtering options on dashboards.
Before you begin
Role required: admin
Procedure
What to do next
Define the filtering logic.
Create a custom date/time filter option
When the standard selection of date/time filter options doesn't meet your needs, you can create a custom option.
Before you begin
Follow these steps to create a custom Date/Time filter option that can then be included in any Date/Time-based interactive filter for use on a Dashboard. In this example, you create a filter option for the period of a two weeks, a fortnight.
Role required: admin.
Procedure
Define filtering logic - example
After you create the interactive filter, add the filtering logic.
Before you begin
Role required: admin
Procedure
Result
The custom interactive filter appears on the dashboard you added the dynamic content block to. It is also in the list of content blocks in the Add Widgets panel.
Custom interactive filter example - Multiple reports
You can use a custom interactive filter to filter multiple reports using different tables. There are two different APIs to publish an interactive filter for a single table or multiple tables. This example filters a report on the incident and problem tables by assignment group using a custom interactive filter.
About custom interactive filters on multiple tables
- Custom interactive filters that apply to only one table use the function DashboardMessageHandler.publishFilter().
- Custom interactive filters that apply to multiple tables use the function DashboardMessageHandler.publishMessage().
- Before you publish, an interactive filter call to the SNC.canvas.interactiveFilters.setDefaultValue() function is required.
- A call to either the SNC.canvas.interactiveFilters.removeDefaultValue() or the DashboardMessageHandler.removeFilter() function is required before you reset the filter.
A custom interactive filter that calls the publishFilter() method multiple times refreshes the associated report the same number of times. Repeated calls to this method can cause performance issues.
How to apply Custom Interactive Filter to multiple tables
The following example filters the report by assignment group on the Incident [incident] and Problem [problem] tables.
DashboardMessageHandler.publishMessage() accepts multiple filters as an array. Construct the filter array and then create a single instance of DashboardMessageHandler which calls DashboardMessageHandler.publishMessage([filters]). This method refreshes the widget only once.
Example
On this page
Related Content
- Configure a content block
- UI scripts
- Jelly tags
- DashboardMessageHandler
Provides methods to define custom filtering logic for interactive filters.