Apply and delete filters
Applying filters
There are two ways in which you can apply filters to a Vizpad:
Local Filter (filters applied to a Viz)
Global filters (filters applied to all the Viz in a Vizpad)
Local filter
To apply a local filter, the following fields need to be provided:
actionType: vizFilter
vizID: ID of the Viz
column: column name for which the filter is to be applied
value: value to be applied
operator: operator to be applied
When the following code is applied, the filter "Sales >= 10000" will be applied to the individual Viz (of ID "vizID_for_local_filter) of a Vizpad.
telliusFrame.postMessage ({
actionType: "vizFilter",
filters: [{
vizId: "vizID_for_local_filter",
value: "10000",
column: "Sales",
operator: ">="
}]
}, "*");Global filter
To apply a global filter at the tab level, the following fields need to be provided:
actionType: vizpadFilter
column: column name for which the filter is to be applied
value: value to be applied
operator: operator to be applied
allTabs: If set to
true, then the filters will be applied for all the tabs in a Vizpad. If set tofalse, then the filters will be applied only to the currently active tab.
When the following code is applied, the filter "Ship_Mode does not contain 'same'" will be applied to all the Viz present in the current tab (since allTabs is set to false) of a Vizpad.
Supported filters
The following are the types of filters supported in a Vizpad:
Operators
Timeline filters
Resolution filters
Operators
< (less than)
<= (less than or equal to)
> (greater than)
>= (greater than or equal to)
= (equal to)
!= (not equal to)
>= & <= (between)
in
not in
like (contains, starts with, ends with)
not like (does not contain, does not start with)
When like operator is used, you can use the value contains or starts with or ends with for the conditionName field as required. If no conditionName field is mentioned, it will be considered as contains.
Here is a sample code for like operator that uses conditionName field.
Two filters are required to support the between operator.
Here is a sample code for using between operator:
Timeline filters
The following operators are supported for timeline filters
Today
Yesterday
Last 5 days
Last 7 days
Last 15 days
Last 30 days
Last week
Last month
This month
Last 3 months
Last 6 months
This year
Last year
Last 3 years
Last 6 years
Custom range (user-defined time period)
Here is a sample code for applying custom time range:
Resolution filters
The following operators are supported for the resolution filter:
Hourly
Daily
Weekly
Monthly
Quarterly
Yearly
Here is a sample code for applying the resolution filter:
Removing filters
To remove a filter (local or global), the following fields need to be provided:
actionType: remove all filters or a specific filter from a Viz/Vizpad
Id: ID of the filter
vizID: ID of the Viz (if required)
The following are some of the code samples on removing filters in different ways:
To remove all filters applied to a Vizpad
To remove a specific filter applied to a Vizpad (removes the specific filter from all the Viz and all the tabs)
To remove a specific filter applied to a Viz
Was this helpful?