This method reads the attribute values and timestamps from the history database for the specified time domain for an item. If the current values for the attributes are desired, endTime is MinValue time. This method is intended to be used to retrieve attributes that have changed to correlate the values of these attributes with the values of their data. For example, the recalibration of a sensor may have required the normal maximum and minimum attributes to be changed. If the only attribute values available for the item are the current values, these shall be returned and errors set to OPC_S_CURRENTVALUE. Except for the case where current values are requested (endTime = MinValue), the server shall always return a beginning bounding value. Thus, if the client requests attribute values for Jan1, 1997 to October 1, 1997, the server shall return a value for the attribute on Jan 1, 1997, rather than the first value returned being the first new value for the attribute after Jan 1, 1997. Likewise, the timestamp for that first value shall be Jan 1, 1997, regardless of when the attribute actually took that value. All other timestamps shall be for the time when the value of the attribute changed. Note that while the client can query the server for the native datatype of an ItemID, the client cannot assume that all data sent from the server will be that datatype. The datatype of a given ItemID may have changed over the life of the Item, and thus clients should be able to handle receiving data of a different datatype than that returned from this call.
Visual Basic (Declaration) | |
---|---|
Overloads Function ReadAttribute( _ ByVal startTime As Date, _ ByVal endTime As Date, _ ByVal serverHandle As Integer, _ ByVal attributeIDs() As Integer, _ ByRef AttributeValues As OPCHDAAttribute(), _ ByRef errors As Integer() _ ) As Integer |
C# | |
---|---|
int ReadAttribute( DateTime startTime, DateTime endTime, int serverHandle, int[] attributeIDs, out OPCHDAAttribute[] AttributeValues, out int[] errors ) |
Parameters
- startTime
- The beginning of the history period to be read.
- endTime
- The end of the history period to be read.
- serverHandle
- The list of server item handles for the items to be read.
- attributeIDs
- The list of attribute IDs to be read.
- AttributeValues
- Array of objects in which the item attribute values are returned. The order of the objects in the array shall be the same as the order of attribute IDs.
- errors
- Array of HRESULTs indicating the success of the individual attribute reads. The errors correspond to the attribute IDs passed in dwAttributeIDs. This indicates whether the read succeeded in obtaining a defined value for the requested attribute. NOTE any FAILED error code indicates that the corresponding attribute value is UNDEFINED.
Return Value
HRESULTS success/error code.Target Platforms: Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows 7, Windows Server 2008 family