Mendix 7 is no longer supported unless you have Extended Support (for details, please contact Mendix Support). Mendix 7 documentation will remain available for customers with Extended Support until July, 2024.

Enumerations in Expressions

Last modified: August 2, 2022

Enumerations are referenced by ..

Assume a module “OrderProcessing”, in which an enumeration “Status” is defined with two possible values: “started” and “completed”. To set the value of an attribute in a change action to “completed”, use the following code:

1
OrderProcessing.Status.completed

Conditional statements are also possible:

1
2
3
4
if 4>3 then
  OrderProcessing.Status.completed
else
  OrderProcessing.Status.started

getCaption

Takes an enumeration value and returns the caption of this value. The caption is a translatable string and the result of this function depends on the current language.

Input parameters

  • an enumeration value Type: any enumeration

Output

The caption of the enumeration value in the current language. Type: String

1
getCaption($NewEntity/TestEnum)

getKey

Takes an enumeration value and returns the key (called Name in the Modeler) of this value. The key is the technical name for the enumeration value and is language independent. See also Enumeration Values.

Input parameters

  • an enumeration value Type: any enumeration

Output

The key/name of the enumeration value Type: String

1
getKey($NewEntity/TestEnum)