Enumerations in Expressions

Last modified: September 6, 2024

Introduction

Enumerations are referenced by <modulename>.<enumerationname>.<enumerationvalue>.

For example, you have a module called 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 list, object, or variable activity to completed, use the following input:

OrderProcessing.Status.completed

Conditional statements are also possible:

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

You can also use conditional statements to check whether two enumeration values are the same:

if $Order/Status = OrderProcessing.Status.completed then 
  true 
else 
  false

getCaption

The getCaption function 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

As an input parameter you can use an enumeration value of any enumeration.

Output

The output is described in the table below:

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

Example

If you use the following input:

getCaption($Customer/Grade)

The output can be:

Gouden

getKey

The getKey function takes an enumeration value and returns the key (called Name in Studio Pro) of this value. The key is the technical name for the enumeration value and is language independent. For more information, see Enumerations.

Input Parameters

As an input parameter you can use an enumeration value of any enumeration.

Output

The output is described in the table below:

Value Type
The key (name) of the enumeration value in the current language. String

Example

If you use the following input:

getKey($Customer/Grade)

The output can be:

Golden

Read More