Conditional Logic: Operators and Actions
About
Conditional logic Conditional logic is a tool in the Form Builder that establishes the workflow of a form. By using the "If This, Then That" structure, questions or sections will be displayed, hidden, or automatically populated based on answers to preceding questions. uses two core parts—Conditions and Actions—to control the workflow in a form. Conditions use operators to test if questions match a certain rule, and actions define what happens when those conditions are met.
Below are definitions of all available operators and actions, as well as information regarding what kinds of questions they are compatible with.
Operators
Conditional operators are the (usually mathematical) symbols that form part of the condition. Common operators include, but are not limited to: > < =. They allow you to compare a question's answer to either another question, or a string.
Available Operators
Operator | Definition |
Equals (=) | Checks if the answer is an exact match (case insensitive) to another value of a comparable data type. |
Does Not Equal (!=) | Checks if the answer is NOT an exact match (case insensitive) to another value of a comparable data type. |
Less Than (<) | Checks if the answer is lower than another value of a comparable data type. |
Less Than or Equal To (<=) | Checks if the question is lower than or an exact match of another value of a comparable data type. |
Greater Than (>) | Checks if the answer is higher than another value of a comparable data type. |
Greater Than or Equal To (>=) | Checks if the question is higher than or an exact match of another value of a comparable data type. |
Between | Checks if the question falls between (but is not equal to) two other values of a comparable data type. |
Contains | Checks if the answer contains another value of a comparable data type.
If you are comparing a multiselect question, it checks if one of the multiselect answers is an exact match to another value. |
Is Answered | Checks if the question has an answer. It is considered to have an answer if ANY value is present; whether it is a default value, a pushed value, or a user-entered value. |
Is Not Answered | Checks if the question does NOT have an answer. |
Operators: Compatibility with Questions and Data Types
General Rules:
- The reference question must be a data type compatible with the operator (see tables below).
- If comparing to another question, that question's data type must also be compatible with the operator. For example, you can’t say “If (integer) = (date/time question)”.
- If comparing to a hard-coded value, it must be of a data type compatible with the operator. For example, you can’t say “If (email question) = 5”.
The form builder prevents you from saving a form with these mistakes.
Compatibility by Operator
Name |
Compatible Data Types |
Incompatible Data Types |
Equals
Does Not Equal |
*Except Multiselect questions |
|
Less Than Greater Than Less Than or Equal To Greater Than or Equal To Between |
*Except Multiselect questions |
Question Type: Multiselect |
Between |
*Except Multiselect questions |
Question Type: Multiselect |
Contains |
|
|
Is Answered Is Not Answered |
Compatibility is by question type:
|
Compatibility is by question type:
|
Actions
Actions dictate what happens when a statement is true. In ProntoForms' case, actions can hide a page, make a question required or not required, and other actions - essentially, they change the user's path through the form.
Available Actions
Action |
Applies to |
Definition |
Is Ignored | Pages, Sections |
This setting makes the form act as if the page/section and its data do not exist. The page/section and its data will not be visible and will not be referenced elsewhere. Data on Ignored pages/sections:
Any Required questions on ignored pages/sections will not be enforced. |
Is Not Ignored | Pages, Sections |
Shows the page/section in the mobile form. If the page/section had answers in it, was set to ignored, and is subsequently "not ignored" again, the data will still be there, unless the questions have also been cleared or reset. |
Is Visible | Questions | Shows the question in the mobile form. |
Is Not Visible | Questions |
Hides the question in the mobile form. If it is "Required", it wont' be enforced. If it has an answer, it will not be cleared unless another action does this. Any answer it has can affect the rest of the form and will be submitted. |
Is Required | Questions | Mobile users will be forced to answer the question before submitting the form (unless on an ignored page/section). |
Is Not Required | Questions | Mobile users will not be forced to answer the question. |
Is Read-Only | Questions | Mobile users will not be able to manually alter the answer. |
Is Not Read-Only | Questions | Mobile users will be able to manually alter the answer. |
Is Set to | Questions | Sets a specified answer for a question further ahead in the form. *NOTE: We recommend NOT dispatching into fields that are "set to" a value using conditional logic. It may produce inconsistent results. |
Is Cleared | Questions | Erases an answer to a question (will erase default values). |
Is Reset |
Questions |
Resets a question to its default settings (returns it to its default value). |
Actions: Compatibility
Rules for Actions
- Actions must be valid for the question/item that is being acted on (see below).
- Actions must be performed on pages/sections/questions that occur after ALL the inputs (i.e., sequential).
Compatibility by Operator
Name |
Compatible Question Types | Incompatible Question Types |
Is Visible Is Not Visible |
All |
None |
Is Required Is Not Required |
|
|
Is Read-Only Is Not Read-Only |
|
|
Is Set To |
|
|
Is Cleared |
|
|
Is Reset |
|
|