Extensions.DataType.GetEnumerationByValue

From emotive
Jump to navigation Jump to search

Classification

Name GetEnumerationByValue
Short Description Returns the name in the specified enumeration by the given value
Class Term
Extension OTX DataType extension
Group GetEnumerationByValue related terms
Exceptions OutOfBoundsException
Checker Rules -
Standard Compliant Yes

OTL Syntax

/// Local Declarations
EnumerationSignature EnumerationVariable = EnumerationSignature.EnumerationElement;
/// Flow
EnumerationVariable = DataType.GetEnumerationByValue(IntegerTerm, OtxLink);

Description

GetEnumerationByValue is a term that returns the name in the specified enumeration by the given value.

If the enumeration value does not exist, the OutOfBoundsException exception will be thrown.

Return Value

The Term returns the value, see table below.

Icons Note.png In OTX, Terms are categorized according to its return data type!
Data Type Description
Enumeration Returns the name corresponding to the given value.

Properties

Name Data Type Class Default Cardinality Description
Value Integer Term - [1] The value to be checked inside the specified enumeration.
Enumeration OtxLink - - [1] This attribute identifies the specified enumeration to check the value. The link will point to the corresponding EnumerationSignature.

OTL Examples

package DataType.EnumerationSignature EnumerationSignature1(Integer EnumerationElement1 = 7, Integer EnumerationElement2 = 12);

/// Global Declarations

public procedure main()
{
        /// Local Declarations

        EnumerationSignature1 enumeration1 = EnumerationSignature1.EnumerationElement1;

        /// Flow

        enumeration1 = DataType.GetEnumerationByValue(12, EnumerationSignature1);  
}

See also

EnumerationContainsName
EnumerationContainsValue
EnumerationGetEntryList
GetEnumerationByName
StructureCopy