Learn about different types of branch conditions for your logic
Tripetto offers several types of branch conditions to add the desired logic and smartness to your forms. In this article we explain the different types to do so.
Branches
In Tripetto you use branches to add the desired logic to your form. In this article we showed how to add branches to your form.
Part of each branch are the branch conditions that determine when a certain branch is executed. Let's take a deeper look into that.
Branch conditions
To determine when a certain branch should be shown to your respondents you have to add the desired branch condition(s) to each branch. To do so, you click the button at the bottom of the branch block. Now you can use several types of branch conditions, which we'll describe in detail below:
- Block conditions;
- Evaluate conditions;
- Regular expression conditions;
- Device conditions.
You can use all condition types totally flexible within each branch, so you can also make combinations of different types of conditions and then let the behavior of the branch decide when the branch should be followed.
In that way you can create simple branches with one condition like this example, but you can also make combinations of conditions like in this article.
Block conditions
In most cases the block conditions will be sufficient. You use them to validate if the given answer of a certain question block matches your wish(es).
Depending on the question type, you have several options to check the value of each condition. In general you can choose between:
Fixed value
- A fixed value that you enter in the form builder;Answered value
- A flexible value that your respondent has answered in another question in your form.
Some examples of block conditions:
- If the respondent selects the 'Other...' option at the dropdown question 'Question 1', then show this branch (also see this help article);
- If the respondent gives a rating of '5 stars' at the rating question 'Question 2', then show this branch (also see this help article);
- If the respondent answers 'Option 1' and/or 'Option 2' at the multiple choice question 'Question 3', then iterate through this branch for each selected option (also see this help article);
- If the respondent enters the right password for the password question 'Question 4', then show this branch (also see this help article).
Evaluate conditions
For more advanced conditions based on the respondent's answers, you can use the evaluate condition. Just like the block conditions, you use them to validate if the given answer of a certain question matches your wish(es), but then with some more advanced filters.
Depending on the question type, you have several options to check the value of each condition. In general you can choose between:
Fixed value
- A fixed value that you enter in the form builder;Answered value
- A flexible value that your respondent has answered in another question in your form.
Some examples of evaluate conditions:
- If the respondent does not select 'Option A' at the dropdown question 'Question 5', then show this branch;
- If the respondent selects a date in the date question 'Question 6' that's between 'January 1, 2020' and 'January 31, 2020', then show this branch;
- If the respondent gives a rating of '3 stars or higher' at the rating question 'Question 7', then show this branch;
- If the respondent enters an email address that contains '@gmail.com' at the email address question 'Question 8', then show this branch;
- If the respondent does not answer 'Statement 1' of the matrix question 'Question 9', then show this branch.
Regular expression conditions
Regular expression are a bit more complicated, but very powerful to check if an answered value matches a certain desired format. You declare the desired format in a regular expression. For example:
- If the respondent enters a value that starts with 'hi' at the text question 'Question 9', then show this branch (regular expression used for this:
/^hi/
); - If the respondent enters a value that's exactly 8 uppercase characters (for example a discount code) at the text question 'Question 10', then show this branch (regular expression used for this:
/^[A-Z]{8}$/
); - If the respondent enters a value that's exactly 16 digits (for example a social security number) at the text question 'Question 11', then show this branch (regular expression used for this:
/^[0-9]{16}$/
).
💡 Tip: Generate regular expressions
You can use regex101.com to create and test your regular expressions.
Device conditions
With device conditions you can show/hide certain parts of your form to users of a certain device (based on the screen size). For example:
- If the respondent is using a 'Phone (small screen device)', then show this branch;
- If the respondent is using a 'Desktop (large screen device)', then show this branch;
- If the respondent is using a 'Phone (small screen device) or Tablet (medium screen device)', then show this branch.
More about branch logic
Branch logic is very powerful, so we made some different help articles to help you with this: