Headers with a Boolean data type are used to enter True/False (Yes/No) values.
In OpenGround Professional, these headers contain Yes/No values (Yes equals True and No equals False):
And in Portal, they appear as checkboxes (checked equals True and unchecked equals False):
You may need to write an expression that references a Boolean Header, such as to do something if True and something else if False.
The most reliable way to write such expressions is to explicitly check if the header is True. This is easiest to demonstrate with examples.
In this example, we have added a calculated TestBooleanCalc header that references a TestBoolean Boolean header in the SampleInformation group.
We want the expression to return ‘ABC’ if TestBoolean is True and ‘XYZ’ if False. We use this expression, which explicitly checks if TestBoolean is True:
if(TestBoolean='True','ABC','XYZ')
We see the results in the image above. You’ll note that this expression treats a ‘blank’ Boolean value as False, which is usually desirable.
In this example, we will use the same scenario as above, except the expression referencing TestBoolean will be executed in Template Studio:
if([SampleInformation.TestBoolean]='True','ABC','XYZ')
You will obviously need to modify the examples above for your own purposes and scenarios, but the takeaway is it will generally be most reliable to explicitly check if the Boolean header equals 'True'.
There are alternative ways to write such expressions, and there is often confusion over the best approach. For example, in some scenarios you can check if the Boolean header = 'Yes' instead of 'True' or assume True/False is implied such as with an expression like if(TestBoolean,'ABC','XYZ'). However, these alternative approaches do not work in all scenarios and/or may not desirably handle 'blank' Boolean values. So, the approach demonstrated above is generally recommended.