Question

Templated filter not found error

  • 29 June 2017
  • 5 replies
  • 433 views

I’m trying to create a templated filter for dates in my View file. Here’s the gist of my code:


view: myview{
derived_table: {sql:
...some_sql...
where {% condition date_filter %} start_datetime {% endcondition %}
...some_sql...;;
}
filter: date_filter{
type: date
default_value: "7 days ago for 7 days"
}
}
}

But I keep getting a "Variable not found “date_filter” error. Does anyone know what I’m doing wrong?


TIA!


5 replies

Userlevel 3
Badge

Hey @gklo,


This error often comes up when this view is being referenced in an explore using the from parameter. You can combat this case by appending the view name in the templated filter such as {% condition myview.date_filter %}


Let me know if that works for you!


Morgan

Thanks, Morgan! Unfortunately, it’s still not working. My colleague was able to get it running in another repo, though. Do you think it could be a permissions issue?

Userlevel 3
Badge

Hi @gklo,

I encourage you to come on chat or visit help.looker.com so we can get some more details from you!

Hi I’m also trying to get this to work and the above solution did not work for me either. Was there an alternative suggestion you had to get it to work?

nevermind, I found my answer here – Templated filters and derived tables

Reply