FindGT
- Last UpdatedJan 11, 2023
- 2 minute read
- PI System
- PI Server 2024 R2
- PI Server
Find the first time within a time interval when an attribute is greater than a specified value.
Syntax
FindGT(attname, starttime, endtime, x)
Arguments
-
attname
The name of an attribute enclosed in single quotation marks
-
starttime
time expression representing the beginning of a time range enclosed in single quotes; can be a relative time (such as "-3h") in reference to an absolute endtime
-
endtime
time expression representing the end of a time range enclosed in single quotes; can be a relative time (such as "+1h") in reference to an absolute starttime
-
x
The value to search for; must be an integer or real number or digital state (character string)
Returns
The timestamp closest to starttime within the specified interval when the attribute was greater than the specified value. Returns the corresponding system digital state (, , and the like) if the attribute was never greater than the specified value.
Exceptions
None
Notes
-
If needed, interpolation is done between attribute values to determine when the attribute was greater than the specified value
-
Interpolation occurs when:
-
the underlying PI point has step attribute turned off
-
there is no recorded value with the specified timestamp
-
-
The interpolated value will be based on the values before and after the timestamp
-
No value will be interpolated if the step attribute is turned on. In this case, the value of record will be that at the time of the event (if it exists) or the previously-recorded value
-
If endtime is earlier than starttime, the time interval is searched backwards
Example
-
FindGT('att1', 't', '*', 40)
[Return the timestamp of the first time after midnight today when 'att1' was greater than 40]
-
FindGT('att1', '-1h', '*', TagVal('att1', 'y+18h'))
[Return the timestamp of the first time since an hour ago when the value of 'att1' was greater than its value at 6pm yesterday]