Skip to main content
Version: V3 (Ignition 8.3)

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

ParameterTypeNullableDescription
valueObjectFalseThe value to convert.
dataTypeObjectFalseThe 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)