lilila opened a new issue #9328: Jinja filter defined in DataSource not 
considered in "Explore Chart"
URL: https://github.com/apache/incubator-superset/issues/9328
 
 
   A clear and concise description of what the bug is.
   
   ### Expected results
   
   I have defined filters in the definition of the data source using jinja 
template 
   
   For instance:
   ` {% set title_target =   ' "'  + filter_values('title_target', 'Joker' )[0] 
 + '" '  %} `
   
   title_target is not a field of the data source itself. I use this variable 
to generate "readable" subqueries. 
   
   `{% set title_target_id =   ' (SELECT id FROM film_id WHERE title = ' + 
title_target + ' ORDER BY release_date DESC LIMIT 1)'   %} `
   
   Which allows me to write my datasource as : 
   
   SELECT 
        a,b,c
   FROM
        `view_nielsen_tracking_films`
   WHERE film_id = {{title_target_allocineid}} and title_comp <> {{ 
title_target }}
   
   
   ### Actual results
   
   This logic works very well in the context of dashboard. However if I click 
on "Explore Chart" for a chart based on this datasource the chart always 
displays data for 'Joker' which is the default value (as we `set title_target = 
  ' "'  + filter_values('title_target', 'Joker' )[0] `) even if the filter 
"title_target" is set up. 
   
   How do I get "explore chart" view to load filter_values ? 
   
   #### Screenshots
   
   <img width="888" alt="Screenshot 2020-03-19 at 14 34 29" 
src="https://user-images.githubusercontent.com/607430/77073043-e5fe4280-69ee-11ea-8c53-6377a6d660a9.png";>
   
   You can see on this plot the title_target filter set to "Miss" and the 
result shows "Joker" the default "filter_value"
   
   ### Environment
   
   (please complete the following information):
   
   - superset version: superset 0.36.0.rc1
   
   

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

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

Reply via email to