Hello,
With the hopes of restricting my result set based on a user entered value, I created a view filter with a SQL parameter - simplified for this example:
filter: test_filter_sql {
type: number
sql: 1 = ${test_filter_sql};;
}
Question: How do I reference the entered value of the filter in my SQL statement The above gives me a circular reference exception, which is understandable.
Thanks!
-paul
Solved! Go to Solution.
You’ve got it nearly perfect there, Paul! The one small change we’ll want to make on this is using a different Liquid variable inside of the if statement. Since Liquid if statements are already set aside as Liquid, we can’t use the {% parameter %}
syntax inside of them to pass in the parameter’s value. Instead, we can use the (aptly named) ._parameter_value
variable (more detail on this here in our docs).
So in our example, we can use something like this as our if statement:
{% if our_view.hi_im_a_parameter._parameter_value != "NULL" %}