Conditional row in table with two options

This may be a stupid question, but I can’t figure out why the first option works as intended and the second option doesn’t.

The idea is that this table row does not show if the field contains “Belgium” or “België”. It seems to work with one option, but not with two options (with an “or”)

This works:

|| {#party1^country: #party1^country} || {#party1^country != “belgium”}

This doesn’t work:

|| {#party1^country: #party1^country} || {#party1^country != “belgium” or “belgie”}

See Writing conditions – Help, at the end of the page, re. the “short-circuiting of conditions”.

You’re bumping into a problem that many lawyers are bumping into.

If you say a != b or c then this could be interpreted as

  • a is not equal to (either b or c)
  • (a is not equal to b) or ( c exists )

As a human, you think about the first option. The software, however, applies the second option. It’s a bit similar to the age-old problem of math: is 5 * 4 + 3 equal to 5 * (4 + 3), or (5 * 4) + 3?

Parentheses will solve the problem!

I still don’t get how I should use the parentheses after reading the help-page.

I would assume that I need to do this, but that gives an error.

{#party1^country != (“belgium” or “belgie”)}

Formally speaking, you’re comparing apples with oranges: from the software’s perspective you’re asking:

“Is the piece of text regarding the country equal to true/false?”

Which of course does not make sense, because you’re comparing text to true/false.

The way software analyses your clause, is to

  • first split your expression into two parts, split at the equals-sign
  • the left side results in a piece of text
  • the right side asks “is either the text “belgium” or the text “belgium” longer than 0 characters?” → if so, then result in true, if not then result in false. Obviously the answer is “true”.

This may sound strange, but that’s how the software looks at it. (Clause9 is absolutely not unique in this regard: all programming languages, and software such as Excel, applies the same perspective, with only some small differences.)

Possible solutions:

  • {(#party1^country != “belgium”) AND (#party1^country != “belgie”)}
  • {not(#party1^country = “belgium”) OR (#party1^country = “belgie”))}
  • {not(#party1^country in @list(“belgium”, “belgie”))}

Even though this is a very standard way of approaching this so-called “boolean logic”, we are very aware of how difficult it is for lawyers to wrap their heads around this. That’s why we explain this in detail at Examples of conditions – Help and Writing conditions – Help, with many concrete examples.