Read - method of object PmOpcClientData

It enables reading the selected block from the data group (defined on the Data page) from the OPC server.
Read(Attr As Long, From As Long, To As Long) As Boolean
oClientData.Read Attr, From, To
Attr(Long) The sum of following values determines the transfer method: (see OPC Basic terms)
1 - Data from the DEVICE, otherwise from the CACHE. If DEVICE is entered then the method Read will surely execute communication with the device. Therefore it can be slower than reading from CACHE, but it is for sure that the most recent values were read.
2 - Synchronous access, otherwise asynchronous. The synchronous access comes handy when immediately after calling the Read it is needed to have the read data set on the Data page. The main disadvantge is that the Read can take longer time (because of waiting for data receive) slowing down the whole application.

The asynchronous access the transmission impulse is done, but the data can be received later, therefore immediately after terminating the Read method the data may not be set yet.

From(Long) Index of the first value (zero-based index).
To(Long) Index of the last value (zero-based index). -1 represents "till the end".
Return Values:
true - on success
false - on error
Calling the method oClientData.Read 0,0,-1 is identical to the Refresh method. For reading all data it is better to use the Refresh method.

The Read method needn't be called if the configurator Update from server at server change is set on the Parameters page because the data are then "read" automatically.

See also:
If oClientData.Read(2, 4, 7) Then
End If
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice