![]() |
OTX Reference
|
|
Enumeration is an otx:SimpleType for a list of named Integer values More...

Public Attributes | |
| OtxLink | enumerationType |
| Cardinality [1] Refers to a certain EnumerationSignature. More... | |
| OtxName | init |
| Cardinality [0..1] Element name of the related enumeration. If not specified, the first enumeration element shall be used as initial value. More... | |
Enumeration is an otx:SimpleType for a list of named Integer values
An Enumeration consists of a set of named constants called enumeration elements. Each enumeration element assigns a unique name to a unique IntergerLiteral, so that the name can be used as an EnumerationLiteral inside OTX instead of the integer value. The simple term of the enumerator value is its integer value. Thus, for relational terms, the integer values of the specific enumerator value are used.
Note: IMPORTANT - If the OTX Core conversion term otx:ToString is applied to an Enumeration term, the element name shall be returned. Note: IMPORTANT - If the OTX Core conversion term otx:ToInteger is applied to an Enumeration term, the Integer value shall be returned. Note: IMPORTANT - An Enumeration value can be persisted, see OTX Persistence extension.
Literal
Enumeration values are named constants. Therefore the EnumerationLiteral term will return a reference to the value of the constant that has the name provided in the EnumerationLiteral's elementName field.
Conversion terms
The following table shows the rules for conversion to another data type:
| Conversion | Result | Sample |
|---|---|---|
| ToBoolean | Undefined (should not be used) | |
| ToInteger | Returns the integer value of the enumeration term | Integer n = ToInteger(enumerationSignatureVariable); // Returns 12 (supposed the current enumeration element's value is 12) |
| ToFloat | Undefined (should not be used) | |
| ToString | Returns the name of current enumeration element | String s = ToString(enumerationSignatureVariable); // Returns "EnumerationElement1" |
| ToByteField | Undefined (should not be used) |
| OtxLink OpenTestSystem.Otx.Extensions.DataType.DataTypes.Enumeration.enumerationType |
Cardinality [1]
Refers to a certain EnumerationSignature.
| OtxName OpenTestSystem.Otx.Extensions.DataType.DataTypes.Enumeration.init |
Cardinality [0..1]
Element name of the related enumeration. If not specified, the first enumeration element shall be used as initial value.