HasValueChanged
- Last UpdatedJan 11, 2023
- 1 minute read
- PI System
- PI Server 2018
- PI Server
Determine if the value of an attribute or expression has changed since it was last evaluated during an analysis.
Syntax
HasValueChanged(x)
Arguments
-
x
attribute or expression
Returns
True if the value of x has changed since last evaluated during the analysis; otherwise returns False.
If x is an expression that this function has not yet evaluated during the analysis, then the function returns False.
If x is an attribute that this function has not yet evaluated during the analysis, then the function finds the previous recorded value and compares the current value to that previous value. If there is no previous value, then the function returns False.
Notes
HasValueChanged is a "stateful" function. Previous evaluations are stored in memory and compared against the new value to see if there has been a change in state. If PI Analysis Service restarts during an analysis, memory is flushed and any previous evaluations are lost.
Example
-
HasValueChanged('att1')
-
[Returns True if the value of att1 has changed since last evaluated during the analysis]
-
HasValueChanged('att1'+'att2')
[Returns True if the value of sum of att1 and att2 has changed since last evaluated during the analysis]