How do you create conditional logic? Meaning, how do you instruct the app to conditionally display a Page Block or conditionally add / remove paragraphs from document templates?
Answer: the Expression Editor.
The Expression Editor allows you to create logical rules. These rules can be used to create conditional logic or even define new variables.
You will constantly use the Expression Editor throughout your app building experience. The editor looks slightly different depending on where you find it, but the basic user structure is the same:
Expression Editors create rules, and each rule is made up variables, operators, and values:
Typically, Expression Editors are used to create a rule that, if true, a certain thing happens (e.g. a Page Block is displayed or a variable is added to a template).
You do not need to use every dropdown in the Expression Editor. For some variables, you will notice that we provide "shortcuts" that combine all the required elements of a logical rule into a single item variable:
You can also write complex, multi-line expressions:
You do not need to fill in every dropdown in an expression. This is perfectly valid:
Note: Complex, multi-line expressions are not available in every Expression Editor. For example, the Expression Editor for adding conditional logic to a Question can only accommodate one expression line.
The type of operators you have access to in an expression depend on the datatype of the variable you've selected.
For example, if you start your expression with a True/False variable (known as a "boolean"), you can only use operators such as "and", "or", and "equals".