Data Object
Each time the Trend Binding Callback function is called, a data object will be passed in, containing the following structure:
{ chartinstanceguid: <string>, firsttime: <datetime>, lasttime: <datetime>, message: <string>, numberofvalues: <integer>, penvalues: <array>, timesforreturnalldata: <array>, status: <string> }
- chartinstanceguid: string
A unique identifier assigned to the Trend Binding by the OAS Server. This is used to identify the requesting client and individual binding so the server efficiently provides the client only data that is required and not previously sent. This value is used internally by the OAS Web HMI library.
- firsttime: datetime
A datetime representing the timestamp of the FIRST value in the series of values supplied in the data object. Combined with lasttime, you can determine the time scale for the data set.
- lasttime: datetime
A datetime representing the timestamp of the LAST value in the series of values supplied in the data object. Combined with firsttime, you can determine the time scale for the data set.
- message: string
A message sent from the server in the event of an error. For normal successful callbacks, this will be blank.
- numberofvalues: integer
The number of values in each array of values within the context of this data set.
- penvalues: array
Penvalues are an array of integer arrays, each containing a set of values corresponding directly to Tag Definitions in the Trend Binding. These arrays are provided in the same order that the Tag Definitions. Example:
[ [0.50, 0.653, 0.480, 0.12], [16, 12, 38, 120] ]
The example above corresponds to a Trend Binding with 2 Tag Definitions. The full data structure may look something like the following. Note, that numberofvalues is the number of values in each set of penvalues, not the number of penvalues itself:
{ chartinstanceguid: "d7a2b517-df07-4b5f-ab05-fd6a5e7d534b" firsttime: Fri Jun 28 2013 14:25:39 GMT-0400 (Eastern Daylight Time) lasttime: Fri Jun 28 2013 14:25:42 GMT-0400 (Eastern Daylight Time) message: "" numberofvalues: 4 penvalues: [ [0.50, 0.653, 0.480, 0.12], [16, 12, 38, 120] ], status: "OK" }
- timesforreturnalldata: array
If the returnalldatawithtimes option is set to true, the timesforreturnalldata will be present in the data set. This array will contain the same number if entries in each array for each pen, and each entry will be a timestamp representing the actual date/time for the corresponding pen value.
- status: string
The status of the callback. For successful operations, this will be “OK” and “ERROR” for all others. So you may choose to only process results with the status is “OK” and ignore others, or display a custom message to the user.