• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Question I Want To Understand User-defined Enumeration (enum)

Cecil

17+ years progress programming and still learning.
#1
I trying to understand how to use enumerated type, but reading the documentation is not making a lot of sense. My eyes are just glazing over. I sort of get it from my Visual Basic programming days, but under the ABL it's just not mentally clicking in.

I would like to lean by example and I was wondering if somebody could provide a working demo code of using the enumerated-types.

OpenEdge 11.6
 

Cecil

17+ years progress programming and still learning.
#2
Trying this code and getting the following error messages:

Windows 10 Pro
OpenEdge Release 11.6.3

Code:
ENUM Permission FLAGS:
    DEFINE ENUM None = 0
                Read = 0x01
                Write = 0x02
                Update = 0x02
                ReadWrite = 0x03
                Create = 0x04
                Delete = 0x08
                Execute = 0x10.
END ENUM.

DEFINE VARIABLE myPermission  AS Permission .

 myPermission = Permission:Update.
2017-10-03.png
 

Osborne

Active Member
#3
I am not sure about this, but should ENUM be in a class?:
Code:
/* Permission.cls */
ENUM Permission FLAGS:
   DEFINE ENUM None = 0
               Read = 0x01
               Write = 0x02
               Update = 0x02
               ReadWrite = 0x03
               Create = 0x04
               Delete = 0x08
               Execute = 0x10.
END ENUM.
Then access outside the class:
Code:
/* TestPermission.p */
DEFINE VARIABLE myPermission  AS Permission .

myPermission = Permission:Update.

message myPermission view-as alert-box.