IsFlagSet( ) method
- Last Updated: January 18, 2024
- 1 minute read
- OpenEdge
- Version 12.8
- Documentation
Indicates whether the enum instance has the specified flag(s) set.
Return type: LOGICAL
Access: PUBLIC
Applies to: Progress.Lang.FlagsEnum class
Syntax
|
- flags
- A reference to a
Progress.Lang.FlagsEnuminstance with one or more flags set. A runtime error will be generated if the underlying value of flag is 0. See the Notes for more information.
(thisInstance AND flags = flags)
This means that if flags has multiple flags set, the method returns TRUE only if all the flags in flags are set in the enum instance. For example:
|
|
Notes
- The method raises error if the two enum instances are not the same type.
Because
IsFlagSet()cannot be passed an enum instance with an underlying value of 0, you must check for that case before using the method, using the EQ (=) or NE (<>) operators or theEquals()method, for example. Using thePermissionenum from above, the following example checks that the user's permission level,myPermission, matches the permission level needed,neededPermissions, to perform an operation. The code checks to make sureneededPermissionsis notPermission:Nonefirst, before invokingIsFlagSet():DEFINE VARIABLE neededPermissions AS Permission NO-UNDO. DEFINE VARIABLE myPermission AS Permission NO-UNDO. ... myPermission = Permission:Read. IF (neededPermissions NE Permission:None) OR (NOT myPermission:IsFlagSet(neededPermissions)) THEN MESSAGE "You do not have permission for this operation.". END.