With the use of conditions, you can add rules to your forms. This allows you to automate actions within the form when these conditions are met. For example, you can display additional questions, send notifications, or export data. By assigning an alias, you can set conditions that will activate the container when the specific alias meets the given condition. Various aliases can also be related to each other. Follow these steps to apply conditions within the form:
Where Can I Add a Condition?
- Go to 'My Forms' and select the form to which you want to apply conditions, or create a new form.
- Start a new row. Then, select the container element.
- When you select the container element, you can edit this element. To apply conditions, click on the condition icon in the left black bar. See the image below.
- Next, you will be asked to specify one or more conditions within the container. The content of the container will only be shown if the condition evaluates to 'true'.
Note: If an incorrect input is made (e.g., an unknown alias), the border of the input box will turn red. If the software recognizes and can execute the condition, the border of the input box will turn grey.
![Alias_goed_EN](https://helpcenter.incontrol.app/hs-fs/hubfs/Knowledge%20Base%20Import/Condities%20toevoegen%20aan%20een%20formulier/Alias_goed_EN.png?width=479&height=101&name=Alias_goed_EN.png)
Setting a Single Condition
The purpose of a condition is to display the content of a container in a form when the condition is met. An alias refers to another value within the form. The condition specifies what this value must satisfy. If the value matches the set condition ('true'), the container with this condition will be activated. Several options are possible:
![condities_soorten_EN](https://helpcenter.incontrol.app/hs-fs/hubfs/Knowledge%20Base%20Import/Condities%20toevoegen%20aan%20een%20formulier/condities_soorten_EN.png?width=415&height=332&name=condities_soorten_EN.png)
Example 1 (Condition Based on a Value)
For the alias @v5, a number from 1 to 10 can be given. I want to show a container only if the number given for this question is greater than 5. The condition would be: @v5 >=5. The container will now only be shown if the result of v5 is greater than 5.
![condities_voorbeeld_EN](https://helpcenter.incontrol.app/hs-fs/hubfs/Knowledge%20Base%20Import/Condities%20toevoegen%20aan%20een%20formulier/condities_voorbeeld_EN.png?width=581&height=108&name=condities_voorbeeld_EN.png)
Example 2 (Condition Based on Text)
A container can also be shown or hidden based on a specific word entered in a text input element. The condition is set as follows: @v1 = "Incontrol".
Example 3 (Condition Based on a Calculation)
A condition can also be based on a calculation. In this example, a calculation element checks the result of adding @v10 to @v11. If the multiplication result is greater than or equal to 10, the container will be shown; if it is lower, the container will not be shown. The condition is set as: @v10 + @v11 >= 10.
Combining Conditions
It's possible to link multiple aliases and show a container only if multiple conditions are met. You can use 'and' or 'or'. Using 'and' means the container is shown only if multiple aliases meet the condition.
Example: The container is shown only if the checkboxes for @v6 and @v7 are both checked ('true'). The condition would be: @v6 = true and @v7 = true.
Using 'or' means the container is activated as soon as one of the mentioned aliases or conditions is met.
Example: The container is shown if either of the checkboxes is checked, or both are checked. The condition would be: @v8 = true or @v9 = true.
![Schermafbeelding 2024-06-04 om 16.13.06](https://helpcenter.incontrol.app/hs-fs/hubfs/Knowledge%20Base%20Import/Condities%20toevoegen%20aan%20een%20formulier/Scherm%C2%ADafbeelding%202024-06-04%20om%2016.13.06.png?width=688&height=105&name=Scherm%C2%ADafbeelding%202024-06-04%20om%2016.13.06.png)
Executing Conditions in a Specific Order
Conditions follow a specific order. If no parentheses are used, conditions will first process multiplication (*) and division (/), then addition (+) and subtraction (-), and so on based on the rules below. By using parentheses, you can specify which condition should be evaluated first before following the standard order.
Example: (@alias1 + @alias2) * 2 >= 5.
In this example, @alias1 is added to @alias2 first before being multiplied by 2 due to the parentheses. Finally, it checks if the result of the multiplication is greater than 5 to determine whether to show a container.
Rules
Conditions are evaluated in the following order:
- Parentheses (….)
- Multiplication or division *, /
- Addition or subtraction +, -
- Greater or less than >,=>, <, <=
- Equal to or not equal to =, !=
- 'and'
- 'or'
Supporting Elements
The following variables can be used to set a condition. See the examples for their application.
![condities_variabelen_EN](https://helpcenter.incontrol.app/hs-fs/hubfs/Knowledge%20Base%20Import/Condities%20toevoegen%20aan%20een%20formulier/condities_variabelen_EN.png?width=387&height=403&name=condities_variabelen_EN.png)
Using Checkboxes
The result of checkboxes is used within conditions using 'true' (if the checkbox is checked) and 'false' (if the checkbox is not checked). Containers can be activated if the conditions of multiple checkboxes are met.
![condities_meerdere_checkbox_EN](https://helpcenter.incontrol.app/hs-fs/hubfs/Knowledge%20Base%20Import/Condities%20toevoegen%20aan%20een%20formulier/condities_meerdere_checkbox_EN.png?width=688&height=219&name=condities_meerdere_checkbox_EN.png)
Using Scoped Aliases
Conditions also work with scoped aliases. Read here how a scoped alias can be used.
Using Percentages
If a number is entered in a number field in the form, a condition can be set based on a percentage of the entered number.
Example: For a certain measurement (@number1), the new value may deviate by a maximum of 25% from the number 4. The condition set is @number1 * 25% <= 4.
Technical Capabilities
Want to know more about the technical capabilities of conditions? Check out the article "Setting Conditions in the Form".