Comment on page

Enumerated types

An enumerated type, or enum, is a set of key-value pairs used to define constant values in a solution. Enums can be added as object class properties and referenced directly from within apps and services. As well as defining your own enums, you can access a number of built-in enums.


To add an enum to your data model:
  • Hover over the + icon in the bottom-right of the data model designer.
  • Click Create Enumerated Type.
A typical use case for an enum is to store possible State values for an object, such as Planned, In Progress, and Complete.
As an example, an Event object class might need a property to track if an event has occurred or not. The value of this property can be one of a set of fixed values.
To store these values you can create an enum called Event State with three enum values. The values can be given the display names Planned, In Progress and Complete. Once the Event State enum is created, you can add a State property to the Event object class, with the data type Event State, tying the enum to the object class.
Enums are suitable for properties where you want to retain full control of the possible values. Within your apps, you can build conditions and filters bound to such properties, for example a Text Edit component that is visible if Event.State EQUALS Planned.
Enum values are often exposed in the UI using the Select component, enabling the user to view the available options and make a selection.
An enumerated type example is available under UI Templates in our Showroom. Click on Dialog - New Issue. In the dialog that opens, Category is populated by an enum. Don't have access? Register.


A descriptive name for the enum.
Data Type
The data type of the enum values. This property becomes read only after enum values are added. The options are:
  • Auto: Each enum value is assigned an automatically generated value. This option should be selected in most cases.
  • String: Each enum value can be assigned a custom string.
  • Integer: Each enum value can be assigned a custom integer.
The string and integer types are useful if the values should be readable, or if you are integrating towards external systems with existing values that the solution needs to understand.
A longer description of the enum. For your own reference.
Add tags.
Enum Values

Enum values

Enum values are the key-value pairs, or available options, within an enum.
Display Name
The label to display in the UI. This name is also used to refer to the enum value throughout Appfarm Create.
The value to store in the database when this enum value is chosen, in the format selected under Data Type. If the data type is Auto, this value will be automatically generated and read-only.
An icon from the built-in icon library to represent the enum value. The icon can be displayed in the UI, such as in a List, Table or Map.
A color to represent the enum value. The color can be used to style the color of the Icon (see setting above) or it may be used for defining the color or the (grouping) category of Charts. Example: Product Category is an Enumerated Type with different color for each Enum value. A graph displaying sales per product category may have the color of each data series in the graph controlled by the Enum color of each Product Category.
Dark Theme Color
A color to represent the enum value when a dark theme is applied. If not specified, Color will be used.
A longer description of the enum value. For your own reference.

Built-in enums

Appfarm has a set of built-in enumerated types. These can be referenced in the same way as a normal enum, but the values can not be changed. The built-in enums are used for app variables and service variables.
Appfarm Environment
The four environments: Develop, Test, Staging, and Production.
Device Orientation
The two possible device orientations: Portrait and Landscape.
Device OS
A set of possible operating systems: Android, iOS, iPad OS, Mac OS, Windows and Other.
The languages added to the solution under Internationalization. For example, English and Norwegian.
Object State
The synchronization state of an object: New, Updated, and Synchronized.
Screen Size
The four possible screen sizes: Large, Medium, Small, and Extra Small.
The themes added to the solution under Themes.
Time Zone
World timezones. For example, Australia/Melbourne.
The views in the active app.