Implicit data type conversion
- Last UpdatedJul 23, 2024
- 1 minute read
The InTouch HMI scripting language provides implicit value conversion in assignments between certain data types. However, this can lead to unexpected results, so you should only use this feature with caution.
The following table shows what happens when you assign a value of a certain type to a tag of a different type.
|
Expected data type |
Used data type |
Remarks |
|---|---|---|
|
Discrete |
Integer |
A value of 0 is interpreted as FALSE. Any other value is interpreted as TRUE. |
|
Discrete |
Real |
A value of 0 is interpreted as FALSE. Any other value is interpreted as TRUE. |
|
Integer |
Discrete |
A value of FALSE is converted to 0. A value of TRUE is converted to 1. |
|
Integer |
Real |
Only the value before the decimal separator is used. All decimal places are discarded. |
|
Real |
Discrete |
A value of FALSE is converted to 0. A value of TRUE is converted to 1. |
|
Real |
Integer |
The value is preserved without changes. |
For information on using script functions to convert between other data types, see Convert data types.