Apply a runtime filter
Starting in May 2022, ThoughtSpot rebranded pinboards as Liveboards. For backward compatibility, we currently support internal processes and external methods that use the older naming convention. |
Runtime filters allow you to apply filters to the data returned by the APIs or the visualization or Liveboard you’re embedding. Before you apply a runtime filter, make sure you understand their limitations.
The filters are specified in the called URL as parameters.
Now you are ready to add a runtime filter to your Data API call or Embedded object:
-
Obtain the URL you are using to embed the visualization or call the REST API.
-
Paste the URL it into a text editor.
-
Append the runtime filter to the URL, using the runtime filter operators to get the data you want. The format for the runtime filter depends on how you use it:
- Embedding a board
-
http://<thoughtspot_server>:<port>/ ?col1=<column_name\>&op1=<operator\>&val1=<value\> #/pinboard/<pinboard_id>
- Embedding a visualization
-
http://<thoughtspot_server>:<port>/ ?col1=<column_name\>&op1=<operator\>&val1=<value\> #/pinboard/<pinboard_id>/<visualization_id>
- REST API with a board
-
http://<thoughtspot_server>:<port> /callosum/v1/tspublic/v1/pinboarddata ?id=<pinboard_id> &col1=<column_name\>&op1=<operator\>&val1=<value\>
- REST API with a visualization
-
http://<thoughtspot_server>:<port> /callosum/v1/tspublic/v1/pinboarddata ?id=<pinboard_id>&vizid=%5B<visualization_id>%5D &col1=<column_name\>&op1=<operator\>&val1=<value\>
-
To add additional filters on a particular column, you can specify multiple values by separating them with
&
(ampersand), as in the following example:val1=foo&val1=bar
You can also use the
IN
operator for multiple values, as in this example:col1=<column_name>&op1=IN&val1=<value>&val1=<value>
-
Add additional filters by incrementing the number at the end of each parameter in the Runtime Filter for each filter you want to add, for example,
col2
,op2
,val2
and so on.The following example passes multiple variables to a single column as well as multiple columns. It shows that data values are returned as epoch.
col1=region&op1=IN&val1=midwest&val1=south&val1=northeast &col2=date&op2=BET&val2=<epoch_start>&val2=<epoch_end>
Runtime filter syntax
You can use two different types of syntax for runtime filters.
In the first kind of syntax, you can add the runtime filter after the Liveboard ID.
https://<thoughtspot-instance>.com/#/pinboard/e510f946-f9ce-48ad-a4af-1a40a9cf8add/?col1=fruit&op1=eq&val1=fruit-value
This example translates to:
concat("{caption}pinboard{/caption}https://<thoughtspot-instance>.com/#/pinboard/e510f946-f9ce-48ad-a4af-1a40a9cf8add/?col1=fruit&op1=eq&val1=",fruit)
If you use the above syntax, runtime filters are removed whenever you navigate to a different tab within ThoughtSpot.
In the second kind of syntax, you can add the runtime filter before the Liveboard ID.
https://<thoughtspot-instance>.com/?col1=fruit&op1=eq&val1=fruit-value#/pinboard/e510f946-f9ce-48ad-a4af-1a40a9cf8add/
This example translates to:
concat(concat("{caption}pinboard{/caption}https://<thoughtspot-instance>.com/?col1=fruit&op1=eq&val1=",fruit), #/pinboard/e510f946-f9ce-48ad-a4af-1a40a9cf8add")
If you use the above syntax, runtime filters persist, and will be applied to every Liveboard you navigate to.