Please ensure Javascript is enabled for purposes of website accessibility
Powered by Zoomin Software. For more details please contactZoomin

Analytics and Notifications for PI System Explorer (PI Server 2024 R2)

FindEq

  • Last UpdatedJan 11, 2023
  • 2 minute read

Find the timestamp closest to starttime within a specified time interval when the attribute is equal to a specified value.

Syntax

FindEq(attname, starttime, endtime, x)

Arguments

  • attname

    name of an attribute 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

  • 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 equal to the specified value

Exceptions

If the attribute was never equal to the specified value, an error value is returned

Notes

  • If needed, interpolation is done between attribute values to determine when the attribute was equal to 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

  • FindEq('att1', '-1h', '*', 40)

    [Return the timestamp of the first time since an hour ago (starttime) when ' att1' was equal to 40]

  • FindEq('enum_att1', '30-March-17', '*', "On")

    [Return the timestamp of the first time since the start of day (12am; starttime) on March 30th, 2017 when enumeration value 'enum_att1' was equal to "On"]

In This Topic
TitleResults for “How to create a CRG?”Also Available in