EventCount (Tag-based PE function)
- Last UpdatedOct 04, 2024
- 1 minute read
- PI System
- PI Server 2023
- PI Server
Find the number of Archive events for a point over a given time.
Syntax
EventCount(tagname, starttime, endtime [, pctgood])
Arguments
tagname
A tagname, enclosed in single quotes. This point must represent a continuous variable.
starttime
A time expression representing the beginning of the time range to search.
endtime
A timestamp that is greater than starttime; the end of the time range to search.
Note: When endtime is a future time (such as ), TagCount might include the system digital state No Data and thus is larger than the number of events stored in the PI Archive. Avoid using a future time if possible.
pctgood
Optional. Minimum time percentage, over the given time range, that the point's archived values must be good.
Returns
Number of Archive events for the point within the specified interval.
Exceptions
If the point has no good values or the pctgood minimum is not reached for the given time range, returns an error value.
Example
EventCount('tag1', 'y', '*')
EventCount('tag1', '14-Dec-97', '+1d',70)
EventCount('tag1', '14-Dec-97', '15-Dec-97')