This synchronous function reads the values, qualities, timestamps, user ID, and timestamp of the modification from the history database for the specified time domain for one or more items.
The purpose of this function is to read values from history that have been modified/replaced. If ReadRaw, ReadProcessed, or ReadAtTime has returned a quality of OPCHDA_EXTRADATA, indicating that there are values which have been superseded, this function reads those values which were superseded.
Only values that have been modified/replaced or deleted are read by this function.
Visual Basic (Declaration) | |
---|---|
Public Overloads Function ReadModified( _ ByVal startTime As OPCHDAtime, _ ByVal endTime As OPCHDAtime, _ ByVal numValues As Integer, _ ByVal server() As Integer, _ ByRef itemValues As OPCHDAmodifiedItem(), _ ByRef errors As Integer() _ ) As Integer |
C# | |
---|---|
public int ReadModified( OPCHDAtime startTime, OPCHDAtime endTime, int numValues, int[] server, out OPCHDAmodifiedItem[] itemValues, out int[] errors ) |
Parameters
- startTime
- The beginning of the history period to be read.
- endTime
- The end of the history period to be read.
- numValues
- The maximum number of values returned for any item over the time range. If only one time is specified, this number specifies the extent of the time range.
- server
- The list of server item handles for the items to be read.
- itemValues
- OUT: Array of structures in which the item values are returned. The order of the structures in the array shall be the same as the order of the server item handles.
- errors
- OUT: Array of HRESULTs indicating the success of the individual item reads. The errors correspond to the handles passed in server. This indicates whether the read succeeded in obtaining a defined value, quality and time stamp. NOTE that any FAILED error code indicates that the corresponding OPCHDA_MODIFIEDITEM struct is undefined.
Return Value
S_OK, OPC_E_BADRIGHTS, OPC_E_INVALIDHANDLE, OPC_S_NODATA, OPC_S_MOREDATA, E_INVALIDARG, E_FAILThe domain of the request is defined by startTime, endTime, and numValues; at least two of these must be specified.
If endTime is less than startTime, or endTime and numValues alone are specified, the data shall be returned in reverse order, with later data coming first. If all three are specified, the call shall return up to numValues results going from startTime to endTime, in either ascending or descending order depending on the relative values of startTime and endTime.
If more than numValues results exist within that time range, the errors entry for that ItemID shall be OPC_S_MOREDATA.
If numValues is 0, then all the values in the range are returned.
If a value has been modified multiple times, all values for the time are returned. This means that a timestamp can appear in the array more than once. The order of the returned values with the same timestamp should be from most recent to oldest modified value. It is server dependent whether multiple modifications are kept or only the most recent.
Target Platforms: Windows 7/8/10, Windows Server 2008/2012/2016, .NET 4.x