Error default assign for boolean input?

Hey Silverfin,

I’m re-working my template for the Enterprise Continuity Act (WCO package) with the new company law and I think I find an error in the use of an assign with a boolean input.

Some example code:

{% input custom.some.suffix as:boolean default:false assign:my_var %}

{{ my_var }}

based on this case you’d think the output of the var my_var would be false (if the boolean is untouched of course), but it’s just blank.

The fix for now, is doing an extra line of coding:

{% input custom.some.suffix as:boolean default:false assign:my_var %}
{% assign my_var = custom.some.suffix | default:false %}
{{ my_var }} 

but the assign in the input statement should do just that: {% assign my_var = custom.some.suffix | default:false %}

It seems it’s related to the boolean though; doing something like this, works like expected:

{% input custom.some.suffix default:"WCO" assign:my_var %}

{{ my_var }} 

Could you take a look at what’s wrong here?

PS the value of my_var is used in my case to compare with another variable (that’s true/false), and this causes issues.

2 Likes

Tested some more, and I think it’s related to having set false in the default without double quotes. In other coding, where no boolean is used, you’d set something between double quotes in the default.
However, that’s pretty confusing as you don’t use it in the assign statement (if coded extra):

{% assign my_var = custom.some.suffix | default:false %} 

And even if you’d use quotes (which is not correct I’d think), you’ll have an issue in an if-statement like this:

{% input custom.some.suffix_5 as:boolean default:"false" assign:my_var %}

{{ my_var }}


{% if my_var %}TRUE{% else %}FALSE{% endif %} 

as the output of the var my_var is false, but the IF-statement would return TRUE

Hi there,

Thank you for your email. It looks like a possible bug in the code, let me submit the query to our core development team and we will get back to you as soon as possible.

Best,
Borja

Hi again,

This should be fixed now. Thank you for spotting it.

Best,
Borja

Yes @borjaGonzalez,

Seems to be working as expected now, thanks for the quick fix! :ok_hand: