Enumerations
The Python execution context employs some enumerations describing field and variable metadata.
Enumerations used
DataType
This enumeration is used for Megaladata data types. Its elements are:
| Name | Value | Represented data type |
|---|---|---|
| None | 0 | |
| Boolean | 1 | |
| DateTime | 2 | |
| Float | 3 | |
| Integer | 4 | |
| String | 5 | |
| Variant | 6 |
DataKind
This represents the discrete/continuous nature of data. Enumeration elements are:
| Name | Value | Represented kind of data |
|---|---|---|
| Undefined | 0 | |
| Continuous | 1 | |
| Discrete | 2 |
UsageType
This enumeration lists dataset field usage types. Its elements are:
| Name | Value | Represented usage type |
|---|---|---|
| Unspecified | 0 | |
| Excluded | 1 | |
| Useless | 2 | |
| Active (also: Used, Input) | 3 | |
| Predicted (also: Output) | 4 | |
| Key | 5 | |
| Group | 6 | |
| Value | 7 | |
| Transaction | 8 | |
| Item | 9 |
Examples of using enumerations
from builtin_data import OutputTable, DataType, UsageType
col0 = OutputTable.Columns[0]
#Checking the value of a property with an enumeration type
if (col0.DataType == DataType.String):
print("Column {} has a string data type".format(col0.Name))
#Outputting numeric representation of enumeration value
print(col0.DefaultUsageType)
#Outputting string representation of enumeration value
print(UsageType(col0.DefaultUsageType).name)
Read on: Output Console