View the original community article here
Last tested: Jan 21, 2019
One way to check if any field from the explore is used as a filter we can use
{% if fieldA._is_filtered or fieldB._is_filtered or ....... %}
But that is long, hard coded and annoying to maintain, so not great
A more dynamic approach is to use some of the liquid parameter available in Looker:
html:
<ul>
<li>link: {{ link }}</li>
<li>split: {{ link | split:"f[" }}</li>
<li>{% assign array = link | split:"f[" %}second part array: {{ array.last }}</li>
<li>{% if array.last contains "date" %}result: logic a {% else %}result: logic b {% endif %}</li>
</ul>
;;
The code above is showing every step by step the process, you only really need a combination of the last two to get it working, but that way it helps the client see how each step performs.
In this particular use case, client wanted to check is any date fields is used as a filter:
1. We take the {{link}} value
2. Then split to remove all the first part about selected fields
3. From the remaining part we check is any of the string value contains 'date'
4. We apply the logic for positive test and negative one
relevant Liquid functions are here
This content is subject to limited support.