LogoLogo
ClausesDatafieldsSpecial FunctionsStylingQ&AAPI
  • Welcome!
  • Getting started
    • What is Clause9?
    • Structuring your clause library
    • Structuring your clauses
    • Drafting modes in Clause9
    • Creating a questionnaire
    • Sample clauses
    • Videos
      • Concepts and datafields
      • Conditions
      • Q&As
      • Binders
      • Styling
      • Enumerations
      • Tables
      • Definitions
      • Snippets
      • Cross-references
      • Special functions
      • Examples of common clauses
      • Import clauses from MS Word
      • Grammatical conjugations
      • Action buttons
      • Alternative clauses
  • Assemble document
    • Document toolbar
    • Clause hierarchies
    • Focus Mode
    • Bulk generation of documents
    • Exporting documents
    • Assemble Document - FAQ
    • How to: Assemble Document
      • Insert images
  • Assemble Document Operations Panel
    • Operations panel
    • File pane
    • Edit pane
    • Document pane
    • Binder pane in the operations panel
    • Search pane
    • Browse pane
    • Terms pane
    • Data dashboard
    • Advanced pane
    • Styling pane
    • Miscellaneous pane
    • Visibility settings & actions menu
  • Binders
    • Binders: general
    • Styling cross-references to subdocuments
    • Global and local definition lists
    • Document and binder properties
    • Styling of a Binder versus subdocuments
    • (Un)locking documents in a binder
    • Binders - FAQ
    • How to: binders
      • Make a subdocument in a binder conditional
  • Clauses
    • Introduction to clauses
    • Clause structure
    • Grammar sheet
    • Writing conditions
    • Examples of conditions
    • Using codes instead of text fragments
    • Bold, italic and underline
    • Special codes
    • Enabled?
    • Links
    • Cross-references
    • Introduction to tables
    • Deviating table styling
    • Shrinking clauses
    • Action buttons
    • Enumerations
    • File position
    • Snippets
    • Parameters
    • Conjugations
    • Mixing data types
    • For-loops
    • Clause versioning
    • Abstract article references
    • Advanced multi-language features
    • Clauses - FAQ
    • How to: clauses
      • Create an ad-hoc clause
      • Create a library clause
      • Make a clause repeat
      • Make a paragraph within a clause conditional
      • Use a shortcut to refer to a concept
      • Insert a line break or page break
      • Creating a list with both predefined options and free input
      • Defining alternative clauses
      • Creating cross-references
      • Creating signature blocks
      • Creating advanced party introduction clauses
      • Automatically numbered annexes or schedules
      • Reuse any clause in a different context
      • Setting MS Word document properties
      • Add action buttons to clauses
      • Electronically signing documents
  • concepts
    • Introduction to concepts
    • Creating concepts
    • Concept labels
    • Links
    • Organising concepts
    • Concepts - FAQ
    • How to: concepts
      • Add predefines to a datafield
  • Datafields
    • Introduction to datafields
    • Types of datafields
    • Rules of thumb for using datafields
    • Data-expressions
    • Datafield aliases
    • Datafield labels
    • Datafield special tags
    • Datafield descriptions
    • Repeating list datafields
    • Datafield predefines
    • Datafields - FAQ
    • How to: datafields
      • Change datafield type
      • Change the datafield's name or alias
  • Definitions
    • Introduction to definitions
    • How to: definitions
      • How do definitions work?
      • Create a definition
  • Files
    • How files are organised
    • Browse files
    • File types
    • Custom styling
    • Legal comments
    • File description
    • Attributes
    • Reporting
    • File name
    • File category
    • Access rights
    • How to: files
      • Creating advanced folders
      • Naming your files
      • Shortcuts to folders or files
  • Q&A
    • About cards
    • Cards pane
    • About changes
    • Changes pane
    • Types of changes
    • Adding conditions
    • Question options
    • Copying & pasting answers
    • Comments, notes & documentation
    • Interactive Q&A inspection
    • Embedding questions into a document
    • “Changes” button
    • Batch create pane
    • Identifiers pane
    • Import pane
    • Edit clauses pane
    • Q&A options
    • Q&A - FAQ
    • How to: Q&A
      • Create predefined answers to a question
      • Add disclaimers
      • Create categories of questions
      • Modify the exported filename
      • Create a question to change the language of a document
      • Send a questionnaire to someone without a ClauseBase account
      • Create questions for repeating list datafields
      • Selecting legal entities & addresses
      • Create a questionnaire using "batch create"
      • Launch other Q&As
    • Leveraging ClauseBuddy Smart Templates in Clause9
  • Import
    • Introduction to importing clauses
    • Uploading clauses
    • Defined terms in Import mode
    • Datafields in Import mode
    • Cross-references in Import mode
    • Assigning folders
    • Conversion process
    • Exporting
    • Stashing intermediate results
    • Tips, tricks & limitations
  • Styling
    • Styling overview
    • Base styling
    • Numbering
    • Definitions styling
    • Enumerations styling
    • Locale styling
    • References styling
    • Page styling
    • Styling of a Binder versus subdocuments
    • Styling: tips and tricks
    • Advanced styling topics
    • Copying headers and footers from an MS Word file
    • How to: styling
      • Using custom fonts
      • Change bullet styling
  • Special functions
    • Introduction
    • Calculations
    • Concepts
    • Conditions
    • Conjugations
    • Content Control Elements
    • Datafields
    • Dates & durations
    • Languages
    • Lists
    • Numbers
    • References
    • Repeating (looping)
    • Special items
    • Text structure
    • Text modification
    • User
    • Q&A
  • Settings
    • Account
    • Preferences
    • Access bundles
    • Favourites
    • Saved searches
    • Saved datafields
    • Styles
    • Default styles
  • Admin
    • General
    • Users
    • User rights
    • Profiles
    • Groups
    • Styles
    • Default styles
    • Attribute models
    • Usage page
    • Custom homepage
    • Global placeholders
    • Access rights
    • How to: admin
      • Adding a new user
      • Disabling a user
      • Managing group memberships
  • Miscellaneous
    • Advanced tips & tricks
    • Typing special symbols on your keyboard
    • Shortcuts
    • Grammar style guide
    • Inserting MS Word files
    • Globo-panel
    • Creating high-quality documents
    • Excel calculations and lookups
  • Integrations
    • Overview
    • Spreadbases
    • E-signing documents
    • Drag & drop integrations
  • For developers
    • Clause9 API
    • Custom functions
    • Example custom functions
Powered by GitBook
On this page
  • The value must be equal to any of a set of predefined values
  • The value must not be equal to certain values
  • Two datafields must have a value equal to some predefined value
  • A “list of texts” datafield must contain a value
Export as PDF
  1. Clauses

Examples of conditions

PreviousWriting conditionsNextUsing codes instead of text fragments

Last updated 1 year ago

The value must be equal to any of a set of predefined values

Example: assume you only want to show some text when a property is located in any of the following cities: Antwerp, Amsterdam, Paris or Barcelona.

The long way to write this is:

{#property^location = "Antwerp" OR #property^location = "Amsterdam" OR #property^location = "Paris" OR #property^location = "Barcelona"}

The shorter and more readable way to write this:

{#property^location in @list("Antwerp", "Amsterdam", "Paris", "Barcelona")}

The wrong way to write this:

{#property^location = "Antwerp" OR "Amsterdam" OR "Paris" OR "Barcelona"}

The reason the above condition does not work, is that — due to the feature — the software will actually interpret this as #property^location = "Antwerp" OR "Amsterdam" = true OR "Paris" = true OR "Barcelona" = true, similar to how the software would interpret a condition such as {#property^location: ...} as meaning “if some value is assigned to this datafield, then show the following text: ….

In other words, because in the wrong example above, for Amsterdam/Paris/Barcelona the comparison misses a second part, the software will implicitly “fill up” this second party with “= true”. Because the words “Amsterdam”, “Paris” and “Barcelona” obviously contain at least one character, these parts will always be true. The end result is that this condition will always be considered true, even when the property’s location is not filled in, and even when the property’s location would for example by “New York”.

The value must not be equal to certain values

Example: assume you do not want to show a certain piece of text for a property located in Moscow or Milan.

The long and probably incorrect way to write this:

{not(#property^location = "Moscow") and not (#property^location = "Milan")}

The above example is probably wrong, because it will also show the piece of text when no value has been assigned to the property’s location, or when the property’s location has been assigned an empty text value. This is probably not what you want. To take this situation into account, you would have to write an even longer version:

{#property^location and (not(#property^location = "Moscow") and not (#property^location = "Milan"))}

This new condition first checks whether some non-empty value is assigned. If so, then it will check whether that value is not equal to either “Moscow” or “Milan”. This works, but is a bit long. This can be shortened to:

{#property^location and #property^location !in @list("", "Moscow", "Milan")}

or even shorter:

{#property^location !in @list("", "Moscow", "Milan")}

Two datafields must have a value equal to some predefined value

Example: a certain bonus is awarded when an employee’s collective labour agreement (CLA) is either nr. 123 or 456, while at the same time the employee’s status must be active or on parental leave.

The double wrong way to write this:

{#employee^cla = 123 or 456 and #employee^status = "active" or "parental-leave"}

The first error is that, due to the short-hand comparison described earlier on this page, the software will actually interpret this as (#employee^cla = 123) or (456 = true) and (#employee^status = "active") or ("parental-leave" = true). This expression will always be true, because any number other than zero (such as 456) and any piece of non-empty text (such as “parental-leave”) will be considered “true” by the software.

The less wrong (but still wrong) way to write this:

{#employee^cla = 123 or #employee^cla = 456 and #employee^status = "active" or #employee^status = "parental-leave"}

This is still wrong, because it is very unpredictable for human beings to remember how this will be interpreted by the software, due to the concatenation of AND and OR. Will the software interpret this as (CLA = 123 OR CLA = 456) AND (status = "active" OR status = "parental-leave)? Or instead as (CLA = 123) OR (CLA = 456 AND status = "active") OR (status = "parental-leave)? Or even in some other way?

There exist “precedence” rules for this, but many people have problem remembering the precedence rules for addition and multiplication of numbers, so even if you remember correctly what the precedence rules are for AND/OR/NOT, the person who comes after you to update your texts will probably make a mistake in the interpretation. In any case, the above condition is hard to read.

A correct solution using parentheses is for example:

{(#employee^cla = 123 or #employee^cla = 456) and (#employee^status = "active" or #employee^status = "parental-leave")}

A shorter version, which drops the concatenation of AND/OR:

{#employee^cla in @list(123, 456) AND #employee^status in @list("active", "parental-leave")}

A “list of texts” datafield must contain a value

Example: a piece of text must be shown when an employee’s fringe benefits (a “list of text” datafield) includes both meals and tuition:

The very wrong way to write this condition:

{#employee^benefits = "meals" or "tuition"}

This not only suffers from the short-circuiting issue described above, but will also result in an error because you are comparing a list of items (i.e., the “list of texts” datafield #employee^benefits) to a single text item (“meals”). For the software, this boils down to comparing apples to oranges, hence the error.

A less wrong (but still wrong) way:

{#employee^benefits = @list("meals", "tuition")}

This will in many cases be wrong, because it will only be true if the benefits include only meals and tuition — i.e. if the list on the left side and the list on the right side are exactly equal and include exactly the same elements. If any other benefit would have been assigned to the employees, then this condition will erroneously become false.

Even when the employee’s benefits consist of only meals and tuition, the above condition may erroneously result in false, when the tuition happened to come before the meals in the datafield, i.e. if the ordering is different. The reason is that list-of-text datafields take ordering into account — after all, in certain contracts, the order of appearance of the elements may be very important.

A correct way to write this condition:

{("meals" in #employee^benefits) AND ("tuition" in #employee^benefits)}

or, somewhat shorter (but also more fancy and probably less readable):

{@is_subset(#employee^benefits, @list("meals", "benefits"))}
short-hand comparisons