DataChange event
Description | The DataChange event is called when the item value or quality changes |
Syntax | DataChange (TransactionID As Long, NumItems As Long, ClientHandles() As Long, ItemValues() As Variant, Qualities() As Long, TimeStamps() As Date)TransactionID — The client specified transaction ID. A non-0 value for this indicates that this call has been generated as a result of an AsyncRefresh. A value of 0 indicates that this call has been generated as a result of the normal subscription processing.NumItems — Number of items returned.ClientHandles — Array of client handles for the items.ItemValues — Array of values.Qualities — Array of Qualities for each item's value.TimeStamps — Array of UTC TimeStamps for each item's value. If the device cannot provide a timestamp, the server will provide one. |
Remarks | If the item values are changing faster than the update rate, only the most recent value for each item will be returned to the client. |
Example | Dim WithEvents AnOPCGroup As OPCGroup Private Sub AnOPCGroup_DataChange (TransactionID As Long, NumItems As Long, ClientHandles() As Long, ItemValues() As Variant, Qualities() As Long, TimeStamps() As Date) ' write your client code here to process the data change values End Sub Dim i As Long '/* Update display with new data For i = 1 To NumItems '/* Update value txtData(ClientHandles(i)) = ItemValues(i) '/* Update Quality field txtQuality(ClientHandles(i)) = Qualities(i) '/* Update timestamp txtTimeStamp(ClientHandles(i)) = TimeStamp(i) Next 'i |
Provide Feedback