@if = undefined and @if = false are the same for true/false datafields?

Hello everyone,

I have a true/false datafield that requires a third “maybe” option. Whilst I have been slowly reworking my true/false datafields into other types, I wanted to try using “undefined” as a quick fix in this case:

@if(#ia^rop-m-revised = undefined, @placeholder(“●”), @if(#ia^rop-m-revised = true, “revision”, “adoption”))

I had hoped the above might work, outputting a placeholder if the true/false-datafield is undefined, and then swapping between the true and false options. However, it does not. Both “undefined” and “false” now output the placeholder.

Is this intended behavior? I know that true/false defaults to “false”, so I can guess that undefined = false to achieve this.

Best
Kai

Yes, this is intended behaviour. Undefined equals false because it is not equal to true.

There is however a way you could reach the result you want to reach using the special function @assigned. It checks whether a value has been assigned to any datafield (including a true/false datafield) and if yes, outputs true. Otherwise it will output false.

It will even output true if the value assigned to the true/false datafield itself is “false”.

1 Like