Enumerations of Built-In Megaladata Entities
The JavaScript code execution context provides built-in enumerations describing the metadata of fields and variables.
Description of enumerations
DataType
Represents Megaladata data types. Includes the following items:
| Item | Value | Data type |
|---|---|---|
| None | 0 | |
| Boolean | 1 | |
| DateTime | 2 | |
| Float | 3 | |
| Integer | 4 | |
| String | 5 | |
| Variant | 6 |
DataKind
Represents Megaladata data kinds. Includes the following items:
| Item | Value | Data kind |
|---|---|---|
| Undefined | 0 | |
| Continuous | 1 | |
| Discrete | 2 |
UsageType
Represents Megaladata field usage types. Includes the following items:
| Item | Value | Field usage type |
|---|---|---|
| Unspecified | 0 | |
| Excluded | 1 | |
| Useless | 2 | |
| Active | 3 | |
| Predicted | 4 | |
| Key | 5 | |
| Group | 6 | |
| Value | 7 | |
| Transaction | 8 | |
| Item | 9 |
Examples:
import { OutputTable, DataType, UsageType } from "builtIn/Data";
let col0 = OutputTable.Columns[0];
// Checking the value of an "enumeration" property
if (col0.DataType == DataType.String) {
// Necessary operations
}
// Ouputting a numeric representation of the enumeration value
console.log(col0.DefaultUsageType);
// Outputting a string representation of the enumeration value
console.log(UsageType[col0.DefaultUsageType]);
Read on: JS Calculator Functions