1. 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)

Discussion in 'Development' started by Cecil, Aug 9, 2017.

Tags:
  1. Cecil

    Cecil 17+ years progress programming and still learning.

    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
     
  2.  
  3. Cecil

    Cecil 17+ years progress programming and still learning.

    Trying this code and getting the following error messages:

    Windows 10 Pro
    OpenEdge Release 11.6.3

    Code (progress):
    1. ENUM Permission FLAGS:
    2.     DEFINE ENUM None = 0
    3.                 Read = 0x01
    4.                 Write = 0x02
    5.                 Update = 0x02
    6.                 ReadWrite = 0x03
    7.                 Create = 0x04
    8.                 Delete = 0x08
    9.                 Execute = 0x10.
    10. END ENUM.
    11.  
    12. DEFINE VARIABLE myPermission  AS Permission .
    13.  
    14.  myPermission = Permission:Update.
    15.  
    2017-10-03.png
     
  4. Osborne

    Osborne Active Member

    I am not sure about this, but should ENUM be in a class?:
    Code (progress):
    1. /* Permission.cls */
    2. ENUM Permission FLAGS:
    3.    DEFINE ENUM None = 0
    4.                Read = 0x01
    5.                Write = 0x02
    6.                Update = 0x02
    7.                ReadWrite = 0x03
    8.                Create = 0x04
    9.                Delete = 0x08
    10.                Execute = 0x10.
    11. END ENUM.
    Then access outside the class:
    Code (progress):
    1. /* TestPermission.p */
    2. DEFINE VARIABLE myPermission  AS Permission .
    3.  
    4. myPermission = Permission:Update.
    5.  
    6. message myPermission view-as alert-box.
     
  5. Stefan

    Stefan Active Member

Share This Page