liveboardEmbed.trigger(HostEvent.OpenFilter,
{ columnId: '<column-GUID>'})
Filter types and application layers
ThoughtSpot Embedded provides a robust filtering framework for Liveboards, Answers, visualizations, and other ThoughtSpot objects with multiple filter types and layered application logic. Filters can be configured using Visual Embed SDK events and parameters at embed time, applied at runtime, or set through UI-driven workflows.
Overviewπ
The behavior of each filter type and the mechanism for setting filters can differ widely. There are different types of filters, which can be applied in the following order:
-
Row-level security (RLS) Rules
Rules are defined at the table level and applied during query generation to all objects derived from that table. Rules can be defined based on the logged-in user, their group memberships, or custom variables.
RLS rules secure data and cannot be altered by the logged-in user.
RLS rules can also be used, along with custom variables and the JSON Web Token (JWT) generated for the user, to implement Attribute-Based Access Control (ABAC). -
Data Model filters
Models can have parameters, formulas, and filters.
Embedding application users cannot affect the formulas or filters, which are always applied, but parameters used in a formula can be set by other methods.
If the user can edit the parameter, use the runtime parameters layer to programmatically set its value. -
Runtime filters and Runtime Parameters
You can define runtime filters and runtime parameters in the browser for a given object at load time. Filters and parameters can be set using the Visual Embed SDK, REST API, or URL query parameters and updated via host events in the Visual Embed SDK.Note-
Runtime filters do not display as UI filter components.
-
Runtime filter limits vary by input path. URL-based runtime filters are capped at 50. When using the Visual Embed SDK
runtimeFiltersproperty, the limit is configurable by a ThoughtSpot administrator, with a default and maximum of 1,000 runtime filters. Filters beyond the enforced limit are silently dropped without an error or warning. See Runtime filter limit for more information.
-
-
Liveboard filters
Liveboard filters are visible as UI components at the top of a Liveboard page. By default, a Liveboard filter applies to all visualizations on the Liveboard. Starting with ThoughtSpot Cloud 26.10.0.cl, a filter can also be scoped to a specific tab or group. For more information, see Scoped filter and parameter updates. When a filter is clicked, a modal with filter options appropriate for the data type is displayed.
Liveboard users can add or modify filters as needed. If you are embedding a Liveboard that includes preset filters, you can programmatically update, reset, or remove filters usingHostEvent.UpdateFilters.
To set Liveboard filter and parameter values at load, use Liveboard filter and parameter overrides. Overrides set the values of the Liveboard filters in this layer. They are not runtime filters (layer 3). -
Liveboard cross filters
Cross filters are ad-hoc filters based on user selection. These filters are used for brushing and linking Liveboard visualizations.
Cross filters are supported only on attribute columns. -
Search query filters
Set via the search query string in Answers and visualizations, not visible as UI filter components on a Liveboard, but can be viewed in Explore or Edit modes.
The lowest layer of filters is defined in the search query for a given Answer or visualization on a Liveboard.
The filter terms are saved as part of thesearch_queryof the object, visible in TML.
Filter attributesπ
When specifying a column for filtering, you must use the exact column name as defined in the model. Filters can be applied to string, number, boolean, Date, Datetime, and time data types.
For the DATE and DATE_TIME data types, some filter types may require the date and time values to be specified in epoch time format.
All operations result in a WHERE clause being applied to the queries generated by ThoughtSpot, or no query being issued if the logic is always false.
A data filter object in ThoughtSpot typically includes the following attributes:
column,columnName, orcolumnId-
The name of the column to filter on. For example,
item typeorproduct. The column value must match the actual column name in the ThoughtSpot model. If the model uses column aliases, use the base column name, not the alias. This attribute is defined ascol1,col2,col3in the object URLs and REST API requests, and ascolumnNamein theruntimeFiltersarray in the Visual Embed SDK. The filter object for host events in the SDK allowscolumnorcolumnName.If there are multiple columns with the same name, you can use the
WORKSHEET_NAME::COLUMN_NAMEformat; for example,"(Sample) Retail - Apparel::city". operator,oper, orop-
The supported operators include:
Operator Description Number of Values EQequals
1
NEnot equal to
1
LTless than
1
LEless than or equal to
1
GTgreater than
1
GEgreater than or equal to
1
CONTAINScontains
2
BEGINS_WITHbegins with
1
ENDS_WITHends with
1
BW_INC_MAXbetween inclusive of the higher value
2
BW_INC_MINbetween inclusive of the lower value
2
BW_INCbetween inclusive
2
BWbetween non-inclusive
2
INis included in this list of values
multiple
NOT_INis not included in this list of values
multiple
- values
-
An array of one or more values to filter by. The values must match the data type of the column.
- type
-
Specifies the type for date filters. Supported types include
YESTERDAY,TODAY,TOMORROW,EXACT_DATE,EXACT_DATE_RANGE,LAST_N_PERIOD,NEXT_N_PERIOD,THIS_PERIOD,PERIOD_TO_DATE,YEAR_ONLY,MONTH_YEAR, andQUARTER_YEAR.
|
Note
|
|
Applying filters before and after loadπ
Runtime filters can be applied at load via Visual Embed SDK, REST API, or URL parameters.
To set Liveboard filter values at load, use Liveboard filter and parameter overrides. After load, Liveboard filters can be updated using HostEvent.UpdateFilters in the SDK.
Search query filters can be applied at load by specifying them in the initial search query when embedding an Answer or Spotter session. For example, in Spotter embed, you can use the searchQuery property to set a pre-defined search (including filters) at load.
When you view an Answer or visualization in Edit mode, the filter UI for search query filters appears above the chart or table. These filters are not shown on a Liveboard. If a Liveboard filter is applied on the same column as a search query filter, the Liveboard filter overrides the search query filter values.
Cross filtersπ
Liveboard users can apply filters across all visualizations based on the current selection using the Filter menu option from the contextual menu. For more information, see Liveboard cross filter.
If the column already has a Liveboard filter and the user applies cross filters, the cross filter replaces the values in the currently applied Liveboard filter. If there is no Liveboard filter applied on a column and the user applies a cross filter, a new filter chip with cross filter values is displayed in the header area. This filter chip is removed when the cross filter is cleared.
Whenever any user action affects a cross filter, a EmbedEvent.CrossFilterChanged fires, which can then be used to trigger a specific action.
Updating filters using host events in Visual Embed SDKπ
To set Liveboard filter values at load, use Liveboard filter and parameter overrides. To adjust the values after the Liveboard is rendered, use the following events.
OpenFilter eventπ
If you have hidden the Liveboard header, you can trigger the action of opening a filter modal dialog using HostEvent.OpenFilter:
UpdateFilters eventπ
The HostEvent.UpdateFilters directly updates the values of an existing filter currently applied on a Liveboard:
liveboardEmbed.trigger(HostEvent.UpdateFilters, {
filter: {
column: "date",
oper: "EQ",
values: ["JULY","2023"],
type: "MONTH_YEAR"
}
});