StrictlyNotEqual
Description: | Returns TRUE if the values are not the same, or if the types are not the same, or if only one operand is Invalid. |
Returns: | Boolean |
Usage: | Script or steady state. |
Function Groups: | Variable |
Related to: | StrictlyEqual |
Format: | StrictlyNotEqual(Parm1, Parm2); |
Parameters: |
Parm1 |
Required. Any value to be compared to parameter 2. |
Parm2 |
Required. Any value to be compared to parameter 1. |
Comments: |
Will return TRUE or FALSE. Will never return Invalid. StrictlyNotEqual(X, Y) yields the same result as !StrictlyEqual(X, Y). Equivalent to: If A != B || Valid(A) != Valid(B) || ValueType(A) != ValueType(B) |
X | Y | X == Y | X != Y | StrictlyEqual (X, Y) | StrictlyNotEqual (X,Y) |
Invalid | Invalid | Invalid | Invalid | TRUE | FALSE |
Invalid | 1 | Invalid | Invalid | FALSE | TRUE |
1 | Invalid | Invalid | Invalid | FALSE | TRUE |
1 | 1 | TRUE | FALSE | TRUE | FALSE |
\AS_1 | \AnalogStatus | FALSE | TRUE | FALSE | TRUE |
\AnalogStatus | \AS_1 | TRUE | FALSE | FALSE | TRUE |
2 | "2" | TRUE | FALSE | FALSE | TRUE |
"2" | 2 | TRUE | FALSE | FALSE | TRUE |
Note 1: AS_1 is an object; an instance of the module \AnalogStatus
Note 2: For text to number comparisons, VTScada will attempt to cast the number to text, then perform a case-sensitive comparison. The order of the operands does not matter.
Examples:
Increment Changed whenever NewValue changes. Supports Invalid values. This is much like a Watch(), but allows you to change states and come back without losing track of the last value of NewValue.
If StrictlyNotEqual(NewValue, LastProcessedValue); [ Changed++; LastProcessedValue = NewValue; ]
Value gets set to Input1 or Input2 whenever they change. Supports Invalid values. Increment counters to see how often you get value from one or the other. It would take much more code to do the following with just Watch().
If StrictlyNotEqual(Value, Input1); [ GotInput1++; Value = Input2 = Input1; ] If StrictlyNotEqual(Value, Input2); [ GotInput2++; Value = Input1 = Input2; ]