Static surveys ask every question in sequence regardless of context. Logic transforms your form into a responsive, intelligent interview that adapts to each respondent’s situation, reduces data entry errors, and eliminates questions that simply do not apply.
Skip logic with relevant
The relevant column is where you fill in your expressions. When the expression evaluates to true, the question is shown; when it evaluates to false, the question is hidden and its value is cleared.
A simple example: if you have a question named has_children of type select_one yes_no, i.e., the question is asking “Do you have children? Answer in yes or no”.
You can set the relevant expression on a follow-up question to ${has_children} = 'yes'. That question will only appear when the respondent has confirmed they have children. Relevance can be chained across many questions and can reference multiple prior answers using and and or operators.
Constraints and validation
The constraint column lets you enforce rules on the value a respondent enters. An expression like . >= 0 and . <= 120 on an age field will reject any value outside a plausible human age range. The . symbol refers to the current field’s value. When a constraint fails, the form displays the message you write in the constraint_message column, allowing you to guide the data collector toward a valid entry without simply blocking them with a cryptic error.
For example, in this case, the constraint_message would be “Please enter a valid age range!”
Constraints are evaluated on submission of each field, not at the end of the form, so problems are caught immediately.
Required fields
Setting the required column to yes on a question prevents the form from advancing — or submitting — until that question has been answered.
The required_message column lets you customize the prompt shown when a required field is left blank.
Calculated fields
calculate is a question type that performs a computation silently, without showing any information to the data collector. The result is stored as a variable that other questions can reference. Common uses include deriving a respondent’s age from a date of birth (today() - ${dob}) or summing values across a repeat group. Calculations use the same expression language as relevance and constraints, giving you access to a full library of mathematical, string, and date functions.
