Identifier Enum
The Define Enum ActionStep creates a set of key-value pairs, each consisting solely of text values. The primary advantage of using Enums is their role as placeholders within an ActionScript. Rather than using hard-coded text values scattered throughout the script, you work with the Enum key, which stands in for the actual text value. This method centralizes value management, enabling you to update a value in just one place within the enumeration if changes are needed. Enums can be defined in a Local Context for use within a single ActionScript or in a Global Context, making them accessible across multiple ActionScripts.
- Open the Programming node in the Workspace Explorer.
- Open the Identifier node, select the Enum ActionStep.
Parameters:
The ActionStep has the following input parameters:
name |
Description
|
---|---|
Context-Scope
|
Defines the range of validity of the variable.
Allowed Context Scopes [Local, Global] |
Name
|
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] |
Value
|
The value of the enum.
Parameters for the "Enum Item" sub-branch:
|
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 with Text as their data type. The key-value pairs for the Enum are then imported from a text file. Subsequently, the key-value pairs of the Enum are iterated through and compared with the value of the variable. If a match is found between both values, the iteration stops, and the corresponding value of the Enum is displayed in a Message Box.
This is the text file imported by the Enum list:
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. |