Sometimes it is convenient to sort end user answer options into categories. These categories can be used later on to simplify the logic when building conditions.
For example, it is helpful to define whether a country is in the EU or not just once, and then build conditions based on EU membership.
This tutorial describes an approach using assigned values. It is a more lightweight approach but does not scale well. You best use it if you have rather few categories, rather few answer options, or if your categories are numeric by nature.
Alternatively, you can also assign answer options to categories using databases. This approach requires more upfront work but scales better later on; it is described here.
Assign answer options to categories
As an example, we have a short list of countries, some of which are in the EU, while others are not. We want to assign information about EU membership to those answer options to simplify the logic later on.
Here is how to proceed:
- Ask the question in your Single Select input (it also works with a Multiple Select). Add all possible answer options. In our example, the answer options are different countries and the node is named Country of residence.
- Use the Assign values to options feature to equip each answer options with a value. In our example, we choose the value 0 for no EU membership, and the value 1 for EU membership.
- When continuing building your module, you can use the assigned value to indicate EU membership (or its absence) and build conditions faster. As an example, you can build the condition companies with less than 100 employees in the EU more conveniently (provided you have asked for the company size, too). Use the Rule Builder and reference the value of the Country of residence variable and check whether it is equal to 1, indicating that the company is located in the EU.