-
Notifications
You must be signed in to change notification settings - Fork 14.6k
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
Adds a new macro to allow getting filter values easily #5547
Conversation
Adds test for filter_values macro Adds doco for filter_values Changes filter_values return type to be a list rather than string
28cf81e
to
bcf347e
Compare
Codecov Report
@@ Coverage Diff @@
## master #5547 +/- ##
==========================================
+ Coverage 63.12% 63.26% +0.13%
==========================================
Files 349 351 +2
Lines 22167 22273 +106
Branches 2462 2470 +8
==========================================
+ Hits 13992 14090 +98
- Misses 8161 8168 +7
- Partials 14 15 +1
Continue to review full report at Codecov.
|
- filter_values always return a list
Ready for review. Thanks! |
Thanks! Just add the following snippet to your superset_config.py to use Manuels code via the jinja context addons until this is merged. SQL:
URL:
superset_config.py:
|
SELECT action, |
@mjsilva how can i pass the since and until dates to the query from dashboard. |
* Adds new macro to get filter values from "filters" and "extra_filters" Adds test for filter_values macro Adds doco for filter_values Changes filter_values return type to be a list rather than string * Makes return value type consistent - filter_values always return a list
filter_values is broken in the newest superset version 0.30. 'filter_values' is undefined |
How do I access the date filter values using this macro? I'm looking to access the "since" and "until" in my date filter. I tried "__from" and "__to" but to no luck. |
Is it possible to get the current username as the parameter? |
@fishfree - Yes you can do that like this, thanks! Just an example in both predicate and select clauses.
|
This does not work as mentioned in the PR, if the column in filter box does not match the one in the other visualization select statement, it throws error because it tries to wrap the query and apply the filter with the column name of the filter box. Steps to reproduce: After that I name the column in Filter Box "something" and "something else" but I get error "something" not present in expr_query, The query generated is somewhat like this What do i do to make the last line disappear from the final query output |
@saurabh1-singh did you ever figure this one out? Having the same problem at our company |
Did you find any solution for this ? |
I guess this was a dummy example, in a real life, wrap it between condition:
|
@avinasht1 were you ever able to resolve the date filter values asked about here? |
We've added a new macro
filter_values
to make it easy to grab the values of a filter box when writing dynamic filter dependent queries.Usage:
Returns:
When filter box is like this:

Fixes #1996