GetDCIValuesEx

Deprecated in 6.2.

Please use getValuesAsDataPoints() method of DCI class instead.

GetDCIValuesEx(node, dciId, startTime, endTime, rawValues, tier, function): Array

Get all values for period of DCI with given ID on given node, returning them as DataPoint objects containing both timestamp and value.

Table 1. Parameters

node

DataCollectionTarget

Data collection target object instance

dciId

Integer

DCI ID

startTime

Integer

Start of the period (as UNIX timestamp)

endTime

Integer

End of the period (as UNIX timestamp). Optional, current time will be used if not specified

rawValues

Boolean

FALSE - return transformed values. TRUE - return raw values. Optional, FALSE by default

tier

String

Data tier to read from: "auto", "raw", "hourly", or "daily" (case-insensitive). Optional, defaults to "auto": aggregated hourly or daily data is used when aggregation is enabled for the DCI and the period would contain more than DataCollection.Aggregation.MaxAutoSelectPoints raw values. Ignored when rawValues is true. Any other name causes a runtime error.

function

String

Aggregation function for tiered data: "avg", "min", or "max" (case-insensitive). Optional, defaults to "avg". Any other name causes a runtime error.

Return

Array of DataPoint objects ordered from latest to earliest for given DCI, (empty array if there are no values in the period), or NULL if DCI with given ID does not exist, is a table DCI, or the database query failed. Each DataPoint contains both the timestamp and the value. This function cannot be used for table DCIs.

startTime and endTime are in seconds, but the returned DataPoint objects contain timestamps in milliseconds since epoch.
// Get data points for the last hour
dataPoints = GetDCIValuesEx($node, FindDCIByName($node, "Status"), time() - 3600, time());
for (dp : dataPoints) {
    println("Timestamp: " .. dp->timestamp .. ", Value: " .. dp->value);
}