Liquid parameter._parameter_value of a yesno parameter returns true and false

Knowledge Drop

Last tested: Nov 5, 2020

In a liquid condition, the parameter._parameter_value variable returns the string that will evaluate to true or false in the given SQL dialect. In most dialects, that’s just 'true' and 'false', but in some it’s '1=1' or '(1=1)' for true and '1=0' or ('1=0') for false. It does NOT return Yes or No. So you can evaluate them like this:

{% if foo._parameter_value == "true" %} 

{% if foo._parameter_value == "false" %}

In a SQL statement, _parameter_value will evaluate directly as true or false, so you can evaluate it like this:

CASE WHEN {{foo._parameter_value}} THEN 'something'

CASE WHEN NOT {{foo._parameter_value}} THEN 'something'

Note that our official recommendation in our Docs on yesno parameters is to avoid using yesno parameters in logical Liquid statements.

This content is subject to limited support.                

Version history
Last update:
‎04-05-2021 03:32 PM
Updated by: