EventCount
- Last UpdatedJan 11, 2023
- 1 minute read
- PI System
- PI Server 2018
- PI Server
Find the number of events for an attribute during a specified time range.
Syntax
EventCount(attname, starttime, endtime [, pctgood])
Arguments
-
attname
attribute with time series data (such as PI point data reference) enclosed in single quotes
-
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
-
pctgood
Optional: Minimum percentage of good values for events within the specified time interval.
Returns
Number of events for the attribute during a specified time range.
Exceptions
Returns an error if the pctgood minimum is not reached for the given time interval.
Notes
If the attribute has very few good values during the time range, this function's result may not be trustworthy. Use the PctGood function to find out what percentage of the values is good.
Example
-
EventCount('att1', 't', '+1h')
[Return the count of events between 12:00 and 1:00am today.]
-
EventCount('att1', 't', '+1h', 80)
[Return the count of events between 12:00 and 1:00am today when at least 80% of the values were good.]