XenoGuard Documentation


Actions » Programming » Identifier » Enum

The action Define Enum contains pairs of keys and values that can be assigned to contain both text and numerical values. The advantage of using keys is that you can work with the Enum key at different places in the action script and serve as a placeholder for the actual value behind the key. Using Enum in your action script prevents hard-coded values from being used and scattered throughout the script. If you need to change the value, you have to do this once in the enumeration. Enum is defined by default in a Local Context that is to be used within an ActionScript or in Global Context, so that it can be used in other action scripts. 

[-] Hide
  1. Open the Programming node in the Workspace Explorer.
  2. Open the Identifier node, select the Enum action.


The action has the following input parameters:

name Description
Defines the range of validity of the variable.

Allowed Context Scopes
 [Local, Global]
The name of the Enum.
Read Only
Specifies whether the key and value pairs can be changed or not.
Data Type
The data type of the Result.

Allowed Context Scopes [Fixed]
Possible Values [Text]
The value of the enum.

Parameters for the "Enum Item" sub-branch:

  • Key - the key of the enum item
  • Value - the value of the enum item

Information The Enum Key cannot be empty and should be unique.

Example 1 (Display the days of the week):

This example creates a local enum named Days of the Week with Text as data type. The key and value pairs are then iterated and displayed in Write Text

Example 2 (Import enum list from a text file):

This example creates a local variable and a local enum named Project 1 and Project Status, respectively. Both have Text as data type. The pair of keys and values of the Enum is then imported from a text file. Afterwhich, the key-value pairs of the Enum are iterated and compared with the value of the variable. If both values match, the iteration ends and displays the Value of the Enum via Message Box.

This is the text file imported by the Enum list:

Information The text file should have two columns for the key-value pair that is separated by any of the following characters: semicolon, comma, colon, or tabulator.

See other identifier operations:

Set Identifier