Try OpenEdge Now
skip to main content
ABL Reference
ABL Syntax Reference : DYNAMIC-ENUM function


Returns an instance of the enumeration type for the specified enumeration member.


[ return-value = ] DYNAMIC-ENUM( enum-type-name, enum-member )
Specifies a data element that is assigned the returned value. The AVM checks that the enum instance returned can be assigned to the target, and the AVM raises an error if the data types aren't compatible.
Specifies the name of an ABL or .NET enumeration type that defines the member. This is a CHARACTER expression that the AVM evaluates to the type name of an enumeration type at runtime.
Specifies an enum member in one of two ways:
*A CHARACTER expression that evaluates to the member name at runtime. For flag enums, this can be a comma-delimited list of member names for two or more members defined by the enum type.
*An INTEGER or INT64 expression that evaluates to the underlying numeric value of the member at runtime. For flag enums, this numeric value can represent two or more members defined by the enum type.
Note: The function generates a runtime error if any specified character or numeric value does not correspond to a defined member.


In the following code fragment, Direction is an enum with a member defined for each of the four cardinal directions (see the ENUM statement for an example of how Direction could be defined), and cNeededDirection is a string that evaluates to the name of one of the members defined by Direction. The code then uses DYAMIC-ENUM to set myDirection as an object reference to an instance of the member specified by cNeededDirection:
DEFINE VARIABLE myDirection AS Direction.

myDirection = DYNAMIC-ENUM("Direction", cNeededDirection).

See also

ENUM statement