system.mes.util.convertToType
Description
Converts a value to the specified data type.
The dataType may be supplied as an Ignition
DataType
or as its String name (for example "Int4", "Float8", "Boolean", "DateTime", "ByteArray").
Syntax
system.mes.util.convertToType(value, dataType)
Parameters
| Parameter | Type | Nullable | Description |
|---|---|---|---|
value | Object | False | The value to convert. |
dataType | Object | False | The target data type, as an Ignition DataType or its String name (e.g. "Int4"). |
Returns
The converted value, or None if the conversion fails.
Code Examples
# Convert the string "123" to an Int4
converted = system.mes.util.convertToType(value="123", dataType="Int4")
print(converted)