Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

filter_values macro does not proper consume single-selection filter from filter box #7486

jimhorng opened this issue May 11, 2019 · 1 comment


None yet
1 participant
Copy link

commented May 11, 2019

using filter_values() macro should properly consume value from single-selection filter from filter box since the code 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.

form post content from filter box value:

  • multiple-selection filter
    "filters": [ {"col": "country_name", "op": "in", "val": ["China"] } ]
  • single-selection filter
    "filters": [ {"col": "country_name", "op": "in", "val": "China" } ]

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:
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;"


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


  • superset version: master
  • python version: Python 3.7.3
  • node.js version: v10.15.3
  • npm version: 6.4.1


Make sure these boxes are checked before submitting your issue - thank you!

  • I have checked the superset logs for python stacktraces and included it here as text if there are any.
  • I have reproduced the issue with at least the latest released version of superset.
  • 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.

@issue-label-bot issue-label-bot bot added the #bug label May 11, 2019


This comment has been minimized.

Copy link

commented May 11, 2019

Issue-Label Bot is automatically applying the label #bug to this issue, with a confidence of 0.88. Please mark this comment with 👍 or 👎 to give our bot feedback!

Links: app homepage, dashboard and code for this bot.

@jimhorng jimhorng referenced a pull request that will close this issue May 13, 2019


make filter_values() macro accept single-selection filter box value #7494

2 of 12 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.