Knowledge Drop

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

  • 6 April 2021
  • 0 replies
  • 371 views

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.                

 

 


0 replies

Be the first to reply!

Reply