You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "rscarborough1996 (via GitHub)" <gi...@apache.org> on 2023/01/27 17:51:00 UTC

[GitHub] [superset] rscarborough1996 commented on issue #16942: {{ from_dttm }} resolves to None when used in a virtual dataset that populates a dashboard filter's values

rscarborough1996 commented on issue #16942:
URL: https://github.com/apache/superset/issues/16942#issuecomment-1406870600

   I am having the same issue in 2.0.0, although my use case is different.
   
   I am displaying a report via a table-valued function like so:
   ```
   {% set operatorId = 'DEFAULT' %}
   {% if filter_values('operatorId')|length == 1 %}
     {% set operatorId = filter_values('operatorId')[0] %}
   {% endif %}
   SELECT * FROM [dbo].[myFunction]({{ operatorId }}, '{{ from_dttm }}', '{{ to_dttm }}')
   ```
   The report runs fine, but when I try to create a filter for operatorId, I get the " bad request" error, like in the image above.
   
   I can partially fix this by setting defaults for these values like this:
   ```
   {% set fromDttm = '1753-01-01 00:00:00' %}
   {% set toDttm = '9999-12-31 23:59:59.997' %}
   
   {% if from_dttm is not none %}
     {% set fromDttm = from_dttm %}
   {% endif %}
   
   {% if to_dttm is not none %}
     {% set toDttm = to_dttm %}
   {% endif %}
   ```
   But, the problem then is that the filter returns every possible value for operatorId, even those that don't exist in the chosen time range. It would be nice if the filter would respect from_dttm and to_dttm.


-- 
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.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org