How do you use a SWITCH?
Within eformity, you can use a 'switch' to show or hide elements based on the different values of a variable. This works like a series of if-else statements but is more organized and efficient. In this article, we explain more about it.
Inserting a SWITCH
Just like inserting an if-else statement, you must first edit a template. To add a 'switch', select a list variable (text). Once you have selected the variable, click on the 'Play' icon.

When you click on the 'Play' icon, a menu opens. In this menu, choose the option 'Insert Switch'. A new element will now open in the sidebar.

This new element is visually represented in the image below. In the first text field 'Switch for', you will see the variable the 'switch' applies to. Then, you can create a case within the 'switch' for each value by clicking the toggle bar next to the desired value.

Finally, you can add a 'Default case' to the 'switch' in an 'Editable dropdown list'. This default case is used if none of the other cases apply.
Warning!
You can also add a 'switch' for normal text variables and numbers. For these, you must create a case for each possible value.
Example of a SWITCH
When you have successfully added a 'switch', you will see the following appear in your document:
[ SELECT variable]
[ CASE Value1]
[ CASE Value2]
[ CASE Value3]
[ CASE Value4]
[ ENDSELECT]
Then, add the desired content as follows:
[ SELECT variable]
[ CASE Value1]
Show this if the variable is equal to Value1
[ CASE Value2]
Show this if the variable is equal to Value2
[ CASE Value3]
Show this if the variable is equal to Value3
[ CASE Value4]
Show this if the variable is equal to Value4
[ ENDSELECT]
Tip!
You can add not only a text line but also entire sections or SmartParts under cases.