In an “enabled” condition of a clause, I have the following code:
#termination^reasons = "light" AND "serious" OR "very serious"
but this does not work like it should. What am I doing wrong?
In an “enabled” condition of a clause, I have the following code:
#termination^reasons = "light" AND "serious" OR "very serious"
but this does not work like it should. What am I doing wrong?
You actually stumble over two different problems here.
First, you should be careful not to concatenate ANDs with ORs, because this leads to ambiguity. In your case: do you mean ((light AND serious) or (very serious)), or instead (light and (serious or very serious)? The software follows the rules of mathematical logic here, but they are so difficult to remember, that you are really recommended to use parentheses — this makes your content much more readable for anyone, including yourself in several months… See https://help.clausebase.com/kb/writing-conditions/#combining-subconditions-andornot for more information.
Leaving aside the parentheses issue, there is a second issue. What the software actually reads here is (#termination^reason = "light") AND ("serious") OR ("very serious")
. In a next step, the software will then convert a simple limb such as “serious” into a real condition with two sides: "serious" = true
, which will always be the case because a non-empty text value is always considered true. So actually what the software internally reads here, is `(#termination^reason = “light”) AND (true) OR (true), which is probably not what you intended.
What you probably intended to say here, was something like: (#termination^reason = "light") OR (#termination^reason = "serious") OR (#termination^reason = "very serious")
.
A more compact way to write this is to convert the three possible reasons into a list, and then check whether the current value of the datafield matches any of the elements of that list: #termination^reason in @list("light", "serious", "very serious")
.