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)

RecordedValuesByCount

  • Last UpdatedJan 11, 2023
  • 2 minute read

Obtain a specified number of values beginning at the requested start time in the direction specified.

Syntax

RecordedValuesByCount(attname, starttime, count [, timedirection, boundarytype])

Arguments

  • attname

    attribute of time series data (such as PI point data reference) enclosed in single quotes

  • starttime

    a time expression representing the beginning of request

  • count

    the number of stored (recorded) values to return. The value must be greater than zero

  • timedirection

    a string indicating the time direction in data retrieval enclosed in double quotes:

    "Backward" - begin at the start time and move backward in time. Values will be returned in time-descending order

    "Forward" - begin at the start time and move forward in time. Values will be returned in time-ascending order

    Note: If unspecified, the default is the "Backward" mode.

  • boundarytype

    a string indicating the data retrieval behavior at the end point of a specified time in double quotes:

    "Inside" - return the nearest recorded values inside the requested time boundary

    "Outside" - return the nearest recorded values on the outside of the requested time boundary

    "Interpolated" - create an interpolated value at the requested time boundary if a recorded value does not exist at that time

    Note: If unspecified, the default is the "Inside" mode.

Returns

An array of the specified number of values (if available)

Exceptions

If the attribute does not support the calls, the function returns an error with indication

Notes

  • When no values are available but you specified "Outside" or "Interpolated" boundary types, a special value (NoData) is returned.

Example

  • RecordedValuesByCount('att1', 't+2h', 5)

    [Return 5 values of 'att1' in time-descending order starting from 2:00am today using the default "Inside" retrieval mode moving backwards in time]

  • RecordedValuesByCount('att1', 't+8h', 3, "Forward", "Outside")

    [Return the first 3 values of 'att1' since 8am today using the "Outside" retrieval mode]

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