Examples of valid and invalid expressions
- Last UpdatedJul 23, 2024
- 1 minute read
The following table shows some valid expressions, along with the expression’s result and the result’s data type.
|
Expression |
Data type of result |
Result |
|---|---|---|
|
37 MOD 4 |
Integer |
1 |
|
37 MOD 4 == 1 |
Discrete |
TRUE |
|
NOT (37 MOD 4 == 1) |
Discrete |
FALSE |
|
InfoAppActive(InfoAppTitle("xyz")) == 1 |
Discrete |
TRUE if a process called "xyz" is running |
|
"Batch " + Text(IntTag, "000") |
Message |
"Batch 010" if IntTag has a value of 10 |
The following table shows some invalid expressions, along with the reason why they are invalid.
|
Expression |
Problem |
|---|---|
|
NOT (37 MOD 4) |
NOT requires a discrete operand. |
|
NOT 37 MOD 4 == 1 |
NOT has a higher precedence than the other operators, so the InTouch HMI tries to apply NOT to the integer value of 37 instead of the discrete result of the comparison. |
|
"Batch " + IntTag |
When using the + operator to concatenate strings, both operands must be strings. |