The GetDataN() function retrieves all values posted to the Platform for the specified data item for the given time period. This function cannot return more than 100 values. Since it returns an array of values, this function MUST be used within a statistical function, either min(), max(), or avg().
Important!
This function is available only if the Axeda® Platform is configured
to enable historical functions.
Historical functions retrieve data from the Platform, which can slow response
time for rules processing. To ensure optimal response time, Axeda
strongly recommends that you limit the amount of data these functions
retrieve, the frequency that the expression rules that use them run, and
the number of assets associated with expression rules that use them. For
example, do not request historical data more than once per second.
If no data exists for a specified data item or time frame, then the function
returns an empty array.
Array GetDataN(String dataitemname, int lastNvalues)
Where:
dataitem - The name of the data item
lastNvalues - The number of values to retrieve
Use this function in combination with the GetDataNForDevice function to compare the values for a data item from the current asset with the values for the same data item from another asset.
max(GetDataN(String dataitemname, int number))
Where:
dataitem - The name of the data item
number - The number of values to retrieve
The following expression retrieves the last 30 values for temperature that were logged and determines if the highest value is over 100:
If: max(GetDataN("temperature", 30)) > 100