Conditions on Sections and Fields

A form can include conditional display of both sections and fields using a rich conditional structure. Conditions are created and edited using the condition editor.

Editing the condition on a section of the form

A condition on a section or field determines whether they will be shown in the form. Conditions are based on the values of one or more fields and are evaluated each time a value changes in the form. This means that when the user enters data in the form, some fields or sections may appear or disappear.

Simple Conditions

A simple condition compares the value of a field with the value entered in the condition. There are three parts to a simple condition: Field, Operator and Value.

The Field is the target field who’s value will be compared. In the condition editor you will see a drop-down list of all of the fields in the notebook. For a condition on a field, you won’t see the field itself.

For the Value you can generally enter a target value or select from a drop-down list of possible values.

The Operator is used to compare the field value and the condition value. The operators available depend on the type of the field.

For select and checkbox values you will see equal and not equal which compare the field value to one of the possible values in the field.

For fields with a string value you will also see greater, less, contains and regex. The greater and less operators will compare the strings alphabetically (‘cat’ is less than ‘dog’). The regex operator allows you to write a Regular Expression to match the field value.

If the field is a MultiSelect field that can have more than one value selected, the operators will be contains-one-of, does-not-contain-any-of, contains-all-of and does-not-contain-all-of. Also here you will be able to select multiple values. So, for example, you could check whether the target field Pet Type contains one of Dog or Cat, or that it does not contain any of Hamster, Gerbil or Rat.

Complex Conditions

The condition editor allows you to combine simple conditions into more complex tests using boolean connectors.

A boolean condition combining two simple conditions on fields

In this example there are two conditions on fields that are combined with the ‘and’ operator, so the condition will hold if both simple conditions hold. You can also use the ‘or’ operator to combine conditions.

Complex conditions can be as complex as you need them to be with nested boolean conditions. In the example below, we combine two ‘and’ conditions with an ‘or’: Either ‘Rock’ is ‘Granite’ and ‘Advanced’ is checked or ‘Rock’ is ‘Sandstone’ and ‘Advanced’ is not checked.

A complex boolean condition.

Editing Complex Conditions

Editing complex conditions can be a little confusing. There are two controls on each condition: the split control (two small rectangles) and the remove control (amber circle with a bar).

The split control can be used to turn a simple condition into a boolean condition. Clicking this control will create a second simple condition and use the ‘and’ operator by default which you can change to ‘or’ if you need to.

The removal control will remove either the simple condition or complex condition it refers to.

The ‘Add Another Condition’ button below a complex condition will add a new clause into an existing ‘or’ or ‘and’ condition.