Try OpenEdge Now
skip to main content
ABL Reference
Class Properties and Methods Reference : GetEnum( ) method
 

GetEnum( ) method

Returns an enum instance of the specified enum member.
Return type: Enum type
Access: PUBLIC
Applies to: Progress.Reflect.AccessMode enumeration, Progress.Reflect.DataType enumeration, Progress.Reflect.Flags enumeration, Progress.Reflect.ParameterMode enumeration, any user-defined enum type

Syntax

GetEnum ( INPUT enum-member-name AS CHARACTER )

GetEnum ( INPUT value AS INT64 )
enum-member-name
The name of an enum member of the enum type the method is invoked on. For a flag enum type, this can be a comma-delimited list of enum members.
value
The underlying numeric value of an enum member of the enum type the method is invoked on. For a flag enum type, this value can represent two or more members.
The method returns an error if a name or numeric value does not correspond to a member of the enum type. The exception to this is that you can pass a value of 0 for a flag enum type even if no member has been explicitly defined for 0.
Both of the lines of code in the following example create an enum instance of type Progress.Reflect.AccessMode and assign vAccess the member Public :
DEFINE VARIABLE vAccess AS AccessMode.

vAccess = AccessMode:GetEnum("Public").
vAccess = AccessMode:GetEnum(1).

Notes

*This method is available for all built-in enums, and the compiler automatically generates it for all user-defined enums. For example, this code excerpt creates an instance of the user-defined Permission flag enum and assigns vPerm the members Write and Create:
ENUM Permission FLAGS:
DEFINE ENUM None = 0
Read = 0x01
Write = 0x02
ReadWrite = 0x03
Create = 0x04
Delete = 0x08.
END ENUM.
DEFINE VARIABLE vPerm AS Permission.

vPerm = Permission:GetEnum("Write,Create").