ENUM( [ type ,] name [=value] [ , name [=value] ... ] )
type | The numeric value type of the values. If omitted, defaults to UNSIGNED4. |
name | The label of the enumerated value. |
value | The numeric value to associate with the name. If omitted, the value is the previous value plus one (1). If all values are omitted, the enumeration starts with one (1). |
The ENUM declaration specifies constant values to make code more readable.
Example:
GenderEnum := ENUM(UNSIGNED1,Male,Female,NonBinary,Unknown);
//values are 1, 2, 3, 4
personFlag := ENUM(None=0,Dead=1,Foreign=2,Terrorist=4,Wanted=Terrorist*2);
//values are 0, 1, 2, 4, 8
namesRecord := RECORD
STRING20 surname;
STRING10 forename;
GenderEnum gender;
UNSIGNED1 personFlag := 0;
END;
namesTable2 := DATASET([{'Boreman','George',GenderEnum.Male,personFlag.Foreign},
{'Bin','O',GenderEnum.Male,personFlag.Foreign+personFlag.Terrorist+personFlag.Wanted}
], namesRecord);
OUTPUT(namesTable2);