Part of Understanding the Calc Editor. This category covers every expression that resolves to true or false. You will reach for these often, because the Visibility, Enabled and Readonly properties and calculation-type validations are all boolean underneath.
The reference below is grouped by what each expression is for. Every group is a separate table so you can scan the one you need.
Logic and comparison
Expression | What it does |
|---|---|
And | True if all terms are true. |
Or | True if one or more terms are true. |
Not | Inverts the result, so true becomes false and false becomes true. |
Xor | True if an odd number of terms are true. |
Equals | True if the first term equals the second. |
Greater-Than | True if the first term is greater than the second. |
Greater-Than-Or-Equal | True if the first term is greater than or equal to the second. |
Less-Than | True if the first term is less than the second. |
Less-Than-Or-Equal | True if the first term is less than or equal to the second. |
Across an array
Expression | What it does |
|---|---|
And-Array-Booleans | The AND result of booleans from within an array. |
Or-Array-Booleans | The OR result of booleans from within an array. |
Xor-Array-Booleans | The exclusive-or result of booleans from within an array. |
Values and fields
Expression | What it does |
|---|---|
Constant | A fixed true or false value. |
Field | A reference to a boolean field. |
Has-Value | True if the field referenced has a value set. |
If | Evaluates a boolean to decide which result to use. |
If-Set | Returns a value if it is set, or a fallback if it is not. |
Integration-Data | A boolean sourced from a string field's integration data. |
Unset | An explicitly unset boolean. |
Text and data sources
Expression | What it does |
|---|---|
Empty-String | True if a string is empty. |
List-Includes-String | True if a string is found in a list of strings. |
Regexp-Matches-String | True if a regular expression can match the string. |
Data-Source-Has-Key | Checks whether a data-source lookup found a matching row. |
Branching, users and groups
Expression | What it does |
|---|---|
Switch-On-Integer | Selects one of a group of values by matching an integer. |
Switch-On-String | Selects one of a group of values by matching a string. |
User-Is-In-Group-Named | True if the current user is in the named group. |
User-Is-In-Group-With-Id | True if the current user is in a particular group, by group ID. |
The has-value pattern
An unanswered field is neither true nor false, it is unset. A Visibility, Enabled or validation calculation that reads a field's value without first checking that the field has been answered can behave oddly before the person has entered anything.
This applies to fields that are not booleans as well. Many Yes/No questions are built as a string field holding "Yes" or "No" rather than a true boolean, and tested with Equals instead of a direct boolean check. Either way the safe shape is the same:
And(
Has-Value(theField),
Equals(theField, "Yes") // or Field(theField), if the field is a true boolean
)Read that as "the person has answered, and their answer is Yes". Build "answered No" the same way, wrapping the second term in Not.
Do not test Not(Has-Value(...)) for a negative answer
Not(Has-Value(theField)) tells you the field is empty, not that the answer was No. Keep the Has-Value term positive and invert the comparison instead.
Worked example
A Quantity field should raise a validation only once it has been answered and the value is greater than zero.
Select the Quantity field and open the Validation tab from the checkmark icon in the right rail. Set the mode to Single Message Validation.
Under CONDITIONS, set the accepting criteria to
must be trueand the source beside it tocalculation. The Calc Editor opens, and its title names the criteria rather than the property, as inquantity | True Calculation (boolean).Build
And(Has-Value(Quantity), Greater-Than(Quantity, Constant(0))), then click OK.Type the text the person should see in Message (When Invalid).
A stored validation does not fire on its own
Validations are evaluated on a workflow transition, not while the person is typing. Open the Workflow tab, select the transition the form should not be able to pass, open that transition's Validations tab, and add this field with ACTIVATE A VALIDATION. Until you do, the validation is saved and never runs.