OPC Historian .NET Server Toolkit Reference
ReadAttribute(DateTime,DateTime,Int32,Int32[],OPCHDAAttribute[],Int32[]) Method

The beginning of the history period to be read.
The end of the history period to be read.
The list of server item handles for the items to be read.
The list of attribute IDs to be read.
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.
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.
Synchronous ReadAttribute.
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.
Syntax
'Usage
 
Dim instance As AppPlugin
Dim startTime As Date
Dim endTime As Date
Dim serverHandle As Integer
Dim attributeIDs() As Integer
Dim AttributeValues As OPCHDAAttribute()
Dim errors As Integer()
Dim value As Integer
 
value = instance.ReadAttribute(startTime, endTime, serverHandle, attributeIDs, AttributeValues, errors)
public 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.
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also

Reference

AppPlugin Class
AppPlugin Members
Overload List

 

 


Copyright © 2004-2019 Advosol Inc. All rights reserved

Send Feedback