You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2019/05/11 02:23:47 UTC
[GitHub] [incubator-superset] jimhorng opened a new issue #7486:
filter_values macro does not proper consume single-selection filter from
filter box
jimhorng opened a new issue #7486: filter_values macro does not proper consume single-selection filter from filter box
URL: https://github.com/apache/incubator-superset/issues/7486
using `filter_values()` macro should properly consume value from single-selection filter from filter box since the [code](https://github.com/apache/incubator-superset/blob/65f7f2920d96de8df17d594204438e7fdaf7668d/superset/jinja_context.py#L116) assume filter values passed to the chart is `list`, where multiple-selection filter does pass as a list, but single-selection filter is passed as a string.
### Expected results
using `filter_values()` macro should properly consume value from single-selection filter from filter box.
e.g. `{{ filter_values('country_name', '123')[0] }}`
### Actual results
The chart set with the macro does not reflecting the filter value changes since `filter_values()` macro only consume the first letter of value from single-selection filter from the filter box.
* SQL with macro:
```
SELECT *
FROM birth_names
WHERE name = {{ filter_values('country_name', '123')[0] }}
```
* actual form post from chart's request
```
"filters": [{"col": "country_name", "op": "in", "val": "China"}]
```
* query result from chart's request
```
"query": "SELECT COUNT(*) AS count\nFROM\n (SELECT *\n FROM birth_names\n WHERE name = C) AS expr_qry\nWHERE ds >= '2019-05-04 00:00:00.000000'\n AND ds <= '2019-05-11 00:00:00.000000'\nORDER BY count DESC\nLIMIT 10000\nOFFSET 0;"
```
#### Screenshots
as image, the country_name is set as single-selection filter

#### How to reproduce the bug
1. Go to filter box (set as single-selection) in dashboard
2. Click on drop-down of filter and select any value
3. related chart with `filter_values()` configured is not reflecting the filter changes
### Environment
- superset version: `master`
- python version: `Python 3.7.3`
- node.js version: `v10.15.3`
- npm version: `6.4.1`
### Checklist
Make sure these boxes are checked before submitting your issue - thank you!
- [X] I have checked the superset logs for python stacktraces and included it here as text if there are 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.
### Additional context
Add any other context about the problem here.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org