Templated filter not found error

lookml
filter

(Gian) #1

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!


(Morgan Imel) #2

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


(Gian) #3

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?


(Morgan Imel) #4

Hi @gklo,
I encourage you to come on chat or email support@looker.com so we can get some more details from you!


(Neal) #5

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?


(Neal) #6

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