ToObject( ) method

Returns an enum instance given the enum type and enum member name or numeric value.

Return type: Progress.Lang.Enum

Access: PUBLIC STATIC FINAL

Applies to: Progress.Lang.Enum class

Syntax

ToObject ( INPUT enum-type-name AS CHARACTER,
           INPUT enum-member-name AS CHARACTER )

ToObject ( INPUT enum-type-name AS CHARACTER,
           INPUT value AS INT64 )
enum-type-name
The name of an enum type.
enum-member-name
The name of an enum member of the specified enum type. 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 specified enum type. For a flag enum type, this value can represent two or more enum members.

The method returns an error if a member 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.

This code excerpt creates an instance of the user-defined Permission flag enum and assigns vPerm the members Write and Create. Both versions of the final statement have the same result:

ENUM Permission FLAGS:
    DEFINE ENUM None = 0
                Read = 0x01
                Write = 0x02
                ReadWrite = 0x03
                Create = 0x04
                Delete = 0x08.
END ENUM.
USING Progress.Lang.*.

DEFINE VARIABLE vPerm AS Permission.

vPerm = CAST(Enum:ToObject(Permission, "Write,Create"), Permission).
vPerm = CAST(Enum:ToObject(Permission, 0x06), Permission).

Notes

See also

GetEnum( ) method