Enumerations
Updated on Sep 23, 2022 2 minutes to readOverview
An enumeration is a list of values that can’t be changed by the user. These values are defined by the application developer. One of the main purposes of enumerations is to limit the number of user choices. Each enumeration contains multiple values which may be defined in multiple languages.
As already mentioned, Application builder uses enumerations to create database tables with a set of stored constant values. Which brings us to a very important feature of enumerations: enumerated values can be reliably used by application script algorithms. Another important feature of enumerations is that the enumeration values are transferred with the Application metadata description, you don’t need to recreate them when you are copying modules between applications.
Use Cases
As an application developer you often have to choose between enumerations and lists. Here is a list of tips that will help you make this choice.
Usage | Enumeration | List |
Values should accessible and modifiable by the final user. | + | |
The value of the attribute affects the logic of the application. | + | |
Ex.: attribute ‘Type’ in a sales invoice may contain 2 values: ‘Invoice’ and ‘Credit note’. The value of this attribute defines how the data object will be handled by the application. | + | |
The list of values is intended to be used in multiple application and has to be transferred between applications without recreating the values each time. | + |
Common examples of enumerations:
Status attributes (values are non-editable by the user):- Quote: new, pending, accepted
- Task: new, in progress, on hold, completed
- Timesheet: planned, fact
Type attributes (values are non-editable by the user):
- Payment: e-transfer, cheque, direct transfer, other
- Sales invoice: invoice, credit note