Introduction
Creates a relationship between two Enum, in order to display only a specific set of values from the second Enum, depending on the selected value in the first Enum.
In this example, we will create a Country and Province/State Enum and add them as params of the “modifyInfo” command. When Canada will be the country selected, only the provinces will be available and of course, only the states will be displayed for USA. The option “other” will also be available, for both countries.
Step-by-step instructions
1. Creating the Country Enum
Create the Country Enum and add its values:
2. Creating the Province/State Enum
Create the second En Enum um and its values: Province&States.
Additional Tips / Notes
Before adding the values to this second Enum, a field named “country” was added. Because it’s of type “country”, it links both Enum together. After the values have been added, through the properties panel, they can be associated with the corresponding country. The value “other” won’t be associated with either country, therefor making it available for all countries.Additional Tips / Notes
By default, the values of an Enum will be listed alphabetically. To change that order, use “rank”. For our example, all provinces and states will be of rank 1, but to get the value “other” at the end of that list for both countries, it was not associated to any rank.
3. Adding Both Enums as Parameters to the Command
Add both Enum to your command’s param.
IMPORTANT: For this to work, the order of the linked Enum in the params of the command is of the upmost importance. Since the selection of the Country drives the displayed provinces or states, it should be the one that comes first in the list of params.
Conclusion
This guide explains how to create related Enum for countries and states/provinces, ensuring that only relevant states or provinces are displayed based on the selected country. By carefully linking the Enum and setting up the command parameters, users can create a dynamic and logical selection process for forms involving geographic regions.