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/01/02 20:29:29 UTC
[GitHub] MatthijsM commented on issue #6381: Date Filtering with Standard
date filter Box directly into SQLab
MatthijsM commented on issue #6381: Date Filtering with Standard date filter Box directly into SQLab
URL: https://github.com/apache/incubator-superset/issues/6381#issuecomment-450975830
I think I am trying to do the same thing? I have created a custom query that uses JINJA templating to add all of the filters provided in the dashboard's filter box to my select statement (simplified version found below). All of the filters work except for the "Since" and "Until" dates specified for my table's temporal column (created_date). If they are not passed to the query in the filter param, how are they passed?
{% set filters = filter %}
SELECT vendor_name AS vendor_name,
customer_name AS customer_name,
sum(line_total) AS rev_total
FROM sales_view
WHERE (0=0)
{% if filters %}
{% for eachFilter in filters %}
{% if eachFilter %}
{% set column_name = eachFilter.get('col') %}
{% set values = eachFilter.get('val') %}
{% set operator = eachFilter.get('op') %}
{% set joined_values = "'" + "','".join(values) + "'" %}
AND {{ column_name }} {{ operator }} ( {{ joined_values }} )
{% endif %}
{% endfor %}
{% endif %}
GROUP BY vendor_name,
customer_name
ORDER BY rev_total DESC
LIMIT 50;
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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