Filters are not kept when exploring from dashboard
- [x] I have checked the superset logs for python stacktraces and included it here as text if any
- [x] I have reproduced the issue with at least the latest released version of superset
- [x] I have checked the issue tracker for the same issue and I haven't found one similar
Superset version
{"GIT_SHA": "b480cb344433d58d41594dca171e90287c57dc4a", "version": "0.26.3"}
Expected results
I have a dashboard with a filter box. I use it to filter. A graph on the dashboard looks interesting, I click on "explore". The filters used to be preserved, and that was an awesome feature.
Actual results
The filters are forgotten :(
@GabeLoins I just reproduced this and the filter was actually applied (the data is filtered) but not restored in the Filters component.
@mistercrunch That's very strange, because my users and I can confirm the filters are not applied
Oh interesting, I simply opened the World's Bank example, applied a filter and followed the link and things were filtered.
Interesting indeed 😃 What kind of information should I look for to put more light on what is happening?
I just reproduced it.
I have a graph defined on a table with a preset filter (source = "TRAVORAMA").
On the dashboard that includes it, I used a filter box to filter on "Since 1 month ago" and label_categorie_initiale IN ("Pose+de+clôture+en+grillage+rigide+(1881)"). Then, when exploring the graph, I got the following URL:
http://192.168.1.144/superset/explore/?form_data={
"datasource":"20__table",
"viz_type":"big_number_total",
"slice_id":213,
"granularity_sqla":"ts_depot",
"time_grain_sqla":null,
"since":"1+months+ago",
"until":"",
"metric":"sum__nbre_projets",
"adhoc_filters":[{"subject":"source","operator":"==","filterOptionName":"filter_hf45d8jnxcr_yani27kg2u","expressionType":"SIMPLE","sqlExpression":null,"fromFormData":true,"comparator":"TRAVORAMA","clause":"WHERE"}],
"y_axis_format":".0f",
"timeseries_limit_metric":null,
"include_search":false,
"percent_metrics":[],
"color_pn":true,
"include_time":false,
"table_timestamp_format":"%Y-%m-%d+%H:%M:%S",
"table_filter":false,
"groupby":[],
"url_params":{},
"page_length":0,
"row_limit":10000,
"order_desc":true,
"having":"",
"order_by_cols":[],
"filters":[{"col":"source","val":"TRAVORAMA","op":"=="},{"col":"label_categorie_initiale","val":["Pose+de+clôture+en+grillage+rigide+(1881)"],"op":"in"}],
"all_columns":["ts_depot","nom_projet","label_categorie_initiale","etat","nbre_selections_brut","Nbre+recrédits"],
"metrics":[],
"having_filters":[],
"align_pn":false,
"where":""
}
The result is that the temporal filter that was defined with the Filter box is preserved, as is the filter on the source field defined on the graph independently from the Filter box. The condition on label_categorie_initiale has not been kept though. Both the chart definition form and the actual result displayed match.
In explore, when I manually add the missing filter, the URL changes into
http://192.168.144/superset/explore/?form_data={
...
"adhoc_filters":[{"subject":"source","operator":"==","filterOptionName":"filter_hf45d8jnxcr_yani27kg2u","expressionType":"SIMPLE","sqlExpression":null,"fromFormData":true,"comparator":"TRAVORAMA","clause":"WHERE"},{"subject":"label_categorie_initiale","operator":"in","filterOptionName":"filter_t892zpelzhm_9rszhbvraaq","expressionType":"SIMPLE","sqlExpression":null,"fromFormData":true,"comparator":["\"Pose+de+clôture+en+grillage+rigide+(1881)\""],"clause":"WHERE"}],
...
"filters":[{"col":"source","val":"TRAVORAMA","op":"=="},{"col":"label_categorie_initiale","val":["\"Pose+de+clôture+en+grillage+rigide+(1881)\""],"op":"in"}],
...
}
Now there are two adhoc_filters.
Conversely, if I now remove completely the adhoc_filters directly from the explore URL, it reverts to the first scenario (temporal filter + preset filter defined on the chart). If instead I remove completely the filters and put back the adhoc_filters, everything works fine (temporal filter + preset filter defined on the chart + manual filter).
It seems therefore the filters option is ignored, and this could be the root of the problem, because when exploring after using a filter box the filters seem to be passed only through the filters argument.
What should be the normal behavior?
I'm noticing this issue too, I can try to take a look.
This issue should be fixed by #5525
There's still the issue that the Filters component does not have the applied filters.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.