'URL filter parameters in Apache Superset dashboards
I'm trying to create simple superset dashboard with a single chart (Big Number) that will filter data based on URL parameter passed to the dashboard. I've tried to fallow this Apache Superset Dashboard Filter with URL parameter ). I've used pattern &preselect_filters={"CHART-ID":{"tableColumnName1":["value1"]}} and then tried to define new filter in a chart like tableColumn = {{ filter_values('tableColumnName1')[0] }}, but this generates error. From my observation it resolves this expression without looking for query param.
How should I use it? Is there a documentation somewhere?
My superset version is 0.37.0
Solution 1:[1]
You can achieve this on Superset with the following syntax:
http://{url}:8088/superset/dashboard/{dashboard_id}/?preselect_filters={{"chart_id"}:{{"column_to_be_filtered"}: {"value_to_be_filtered"}}}
Example
http://0.0.0.0:8088/superset/dashboard/1/?preselect_filters={"10": {"country": "France"}}
For the ID's
Chart/Slice: Click on Edit chart then under parameters look for slice_id
Dashboard: Click on Edit record and notice the last number on the URL:
http://0.0.0.0/dashboard/edit/9
Solution 2:[2]
You can open your dashboard, filter like you want to see and, in bullet menu (top right), click in "Copy chart URL". The URL is a shortened URL that redirects to a pre-filtered version of your dashboard.
Because the name of menu option, I don't know if this is a feature or a useful bug.
Solution 3:[3]
This is different now that the filter box is deprecated and all dashboards use native filters. You need to extend the dashboard URL with the "?native_filters=" RISON syntax, which looks like this:
?native_filters=(NATIVE_FILTER_ID:(__cache:(label:'FILTER_VALUE',validateStatus:!f,value:!('FILTER_VALUE')),extraFormData:(filters:!((col:COLUMN_NAME,op:IN,val:!('FILTER_VALUE')))),filterState:(label:'FILTER_VALUE',validateStatus:!f,value:!('FILTER_VALUE')),id:NATIVE_FILTER_ID,ownState:()))
- NATIVE_FILTER_ID you can find in the "Edit dashboard properties" > "Advanced"
- FILTER_VALUE is the thing you want entered into the filter
- COLUMN_NAME is the name of the column you are filtering on
Here are some links with relevant information:
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | steven |
| Solution 2 | Bruno Caponi |
| Solution 3 |
