Hello, community! This is my first interaction here.
I’m facing some doubts in regard to conditional messages in Looker. I don’t really know if that’s a thing, but here’s the problem:
I’d like to know if there’s anyway I can create a filter that if total respondents < 1, than a message like “No responses have been submitted for this survey round” prompts instead of Looker’s default message.
If something in this question isn’t clear, please let me know.
Thanks in advance!
Solved! Go to Solution.
I believe that in this case, the best alternative would be to use conditional formatting with liquid on the HTML parameter.
Something like this:
dimension: responses_formatted {
sql: ${TABLE}.responses ;;
html: {% if value < 1 %}
" No responses "
{% else %}
{{ value }}
{% endif %}
;;
}
I believe that in this case, the best alternative would be to use conditional formatting with liquid on the HTML parameter.
Something like this:
dimension: responses_formatted {
sql: ${TABLE}.responses ;;
html: {% if value < 1 %}
" No responses "
{% else %}
{{ value }}
{% endif %}
;;
}
I believe that in this case, the best alternative would be to use conditional formatting with liquid on the HTML parameter.
Something like this:
dimension: responses_formatted {
sql: ${TABLE}.responses ;;
html: {% if value < 1 %}
" No responses "
{% else %}
{{ value }}
{% endif %}
;;
}
I have one doubt that I couldn’t understand through the docs. Is that ‘value’ word a constant in these liquid variables, or should I change it for one of my created variables?
Either way, thanks for the response!
Hey @beylouniluciano , in this case, ‘value’ is a variable, defined by the result from the SQL query. Son in this case if your SQL parameter is “responses” then value = responses.
If you add it to other dimensions or measures, the value will be the query on that specific dimension.
TLDR; you can use value every time and will select the value from the selected dimension or measure.