OPC Studio User's Guide and Reference
ReadMultiple Method (EasyUAClientCore)
Example 



OpcLabs.EasyOpcUA Assembly > OpcLabs.EasyOpc.UA Namespace > EasyUAClientCore Class : ReadMultiple Method
Array of OpcLabs.EasyOpc.UA.OperationModel.UAReadArguments. Array of argument objects specifying what to read from an OPC-UA server.
Reads multiple attributes, using array of argument objects as an input.
Syntax
'Declaration
 
Public Function ReadMultiple( _
   ByVal readArgumentsArray() As UAReadArguments _
) As UAAttributeDataResult()
'Usage
 
Dim instance As EasyUAClientCore
Dim readArgumentsArray() As UAReadArguments
Dim value() As UAAttributeDataResult
 
value = instance.ReadMultiple(readArgumentsArray)

Parameters

readArgumentsArray
Array of OpcLabs.EasyOpc.UA.OperationModel.UAReadArguments. Array of argument objects specifying what to read from an OPC-UA server.

Return Value

Array of OpcLabs.EasyOpc.UA.OperationModel.UAAttributeDataResult. Returns an array of attribute data objects. Each object stores the value of an attribute, together with status code and timestamps. The indices of elements in the output array are the same as those in the input array, readArgumentsArray.
Exceptions
ExceptionDescription

A null reference (Nothing in Visual Basic) is passed to a method that does not accept it as a valid argument.

This is a usage error, i.e. it will never occur (the exception will not be thrown) in a correctly written program. Your code should not catch this exception.

Remarks
The size of the input array will become the size of the output array. The element positions (indices) in the output array are the same as in the input array.

 

This is a multiple-operation method. In a properly written program, it does not throw any exceptions. You should therefore not put try/catch statements or similar constructs around calls to this method. The only exceptions thrown by this method are for usage errors, i.e. when your code violates the usage contract of the method, such as passing in invalid arguments or calling the method when the state of the object does not allow it. Any operation-related errors (i.e. errors that depend on external conditions that your code cannot reliably check) are indicated in the result objects returned by the method. For more information, see Multiple-operation Methods and Do not catch any exceptions with asynchronous or multiple-operation methods.
Example

.NET

.NET

COM

.NET

// This example shows how to read data (value, timestamps, and status code) of 3 attributes at once. In this example,
// we are reading a Value attribute of 3 different nodes, but the method can also be used to read multiple attributes
// of the same node.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

using System;
using OpcLabs.EasyOpc.UA;
using OpcLabs.EasyOpc.UA.OperationModel;

namespace UADocExamples._EasyUAClient
{
    partial class ReadMultiple
    {
        public static void Main1()
        {
            UAEndpointDescriptor endpointDescriptor =
                "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer";
            // or "http://opcua.demo-this.com:51211/UA/SampleServer" (currently not supported)
            // or "https://opcua.demo-this.com:51212/UA/SampleServer/"

            // Instantiate the client object.
            var client = new EasyUAClient();

            // Obtain attribute data. By default, the Value attributes of the nodes will be read.
            UAAttributeDataResult[] attributeDataResultArray = client.ReadMultiple(new[]
                {
                    new UAReadArguments(endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10845"),
                    new UAReadArguments(endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10853"),
                    new UAReadArguments(endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10855")
                });

            // Display results.
            foreach (UAAttributeDataResult attributeDataResult in attributeDataResultArray)
            {
                if (attributeDataResult.Succeeded)
                    Console.WriteLine($"AttributeData: {attributeDataResult.AttributeData}");
                else
                    Console.WriteLine($"*** Failure: {attributeDataResult.ErrorMessageBrief}");
            }
        }

        // Example output:
        //
        //AttributeData: 51 {Int16} @11/6/2011 1:49:19 PM @11/6/2011 1:49:19 PM; Good
        //AttributeData: -1993984 {Single} @11/6/2011 1:49:19 PM @11/6/2011 1:49:19 PM; Good
        //AttributeData: Yellow% Dragon Cat) White Blue Dog# Green Banana- {String} @11/6/2011 1:49:19 PM @11/6/2011 1:49:19 PM; Good            
    }
}
# This example shows how to read data (value, timestamps, and status code) of 3 attributes at once. In this example,
# we are reading a Value attribute of 3 different nodes, but the method can also be used to read multiple attributes
# of the same node.
#
# Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

#requires -Version 5.1
using namespace OpcLabs.EasyOpc.UA
using namespace OpcLabs.EasyOpc.UA.OperationModel

# The path below assumes that the current directory is [ProductDir]/Examples-NET/PowerShell/Windows .
Add-Type -Path "../../../Components/Opclabs.QuickOpc/net472/OpcLabs.EasyOpcUA.dll"
Add-Type -Path "../../../Components/Opclabs.QuickOpc/net472/OpcLabs.EasyOpcUAComponents.dll"

[UAEndpointDescriptor]$endpointDescriptor =
    "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
# or "http://opcua.demo-this.com:51211/UA/SampleServer" (currently not supported)
# or "https://opcua.demo-this.com:51212/UA/SampleServer/"

# Instantiate the client object.
$client = New-Object EasyUAClient

# Obtain attribute data. By default, the Value attributes of the nodes will be read.
$attributeDataResultArray = $client.ReadMultiple(@(
        (New-Object UAReadArguments($endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10845")), 
        (New-Object UAReadArguments($endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10853")), 
        (New-Object UAReadArguments($endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10855"))
    ))

foreach ($attributeDataResult in $attributeDataResultArray) {
    if ($attributeDataResult.Succeeded) {
        Write-Host "AttributeData: $($attributeDataResult.AttributeData)"
    }
    else {
        Write-Host "*** Failure: $($attributeDataResult.ErrorMessageBrief)"
    }
}


# Example output:
#
#AttributeData: 51 {Int16} @11/6/2011 1:49:19 PM @11/6/2011 1:49:19 PM; Good
#AttributeData: -1993984 {Single} @11/6/2011 1:49:19 PM @11/6/2011 1:49:19 PM; Good
#AttributeData: Yellow% Dragon Cat) White Blue Dog# Green Banana- {String} @11/6/2011 1:49:19 PM @11/6/2011 1:49:19 PM; Good            
# This example shows how to read data (value, timestamps, and status code) of 3 attributes at once. In this example,
# we are reading a Value attribute of 3 different nodes, but the method can also be used to read multiple attributes
# of the same node.
#
# Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
# OPC client and subscriber examples in Python on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-Python .
# The QuickOPC package is needed. Install it using "pip install opclabs_quickopc".
import opclabs_quickopc
import time

# Import .NET namespaces.
from OpcLabs.EasyOpc.UA import *
from OpcLabs.EasyOpc.UA.OperationModel import *


endpointDescriptor = UAEndpointDescriptor('opc.tcp://opcua.demo-this.com:51210/UA/SampleServer')
# or 'http://opcua.demo-this.com:51211/UA/SampleServer' (currently not supported)
# or 'https://opcua.demo-this.com:51212/UA/SampleServer/'

# Instantiate the client object.
client = EasyUAClient()

# Obtain attribute data. By default, the Value attributes of the nodes will be read.
attributeDataResultArray = client.ReadMultiple([
    UAReadArguments(endpointDescriptor, UANodeDescriptor('nsu=http://test.org/UA/Data/ ;i=10845')),
    UAReadArguments(endpointDescriptor, UANodeDescriptor('nsu=http://test.org/UA/Data/ ;i=10853')),
    UAReadArguments(endpointDescriptor, UANodeDescriptor('nsu=http://test.org/UA/Data/ ;i=10855')),
    ])

# Display results.
for attributeDataResult in attributeDataResultArray:
    if attributeDataResult.Succeeded:
        print('AttributeData: ', attributeDataResult.AttributeData, sep='')
    else:
        print('*** Failure: ', attributeDataResult.ErrorMessageBrief, sep='')

print()
print('Finished.')
' This example shows how to read data (value, timestamps, and status code) of 3 attributes at once. In this example,
' we are reading a Value attribute of 3 different nodes, but the method can also be used to read multiple attributes
' of the same node.
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Imports OpcLabs.EasyOpc.UA
Imports OpcLabs.EasyOpc.UA.OperationModel

Namespace _EasyUAClient
    Partial Friend Class ReadMultiple
        Public Shared Sub Main1()

            ' Define which server we will work with.
            Dim endpointDescriptor As UAEndpointDescriptor =
                    "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
            ' or "http://opcua.demo-this.com:51211/UA/SampleServer" (currently not supported)
            ' or "https://opcua.demo-this.com:51212/UA/SampleServer/"

            ' Instantiate the client object
            Dim client = New EasyUAClient()

            ' Obtain attribute data. By default, the Value attributes of the nodes will be read.
            Dim attributeDataResultArray() As UAAttributeDataResult = client.ReadMultiple(New UAReadArguments() _
               {
                   New UAReadArguments(endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10845"),
                   New UAReadArguments(endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10853"),
                   New UAReadArguments(endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10855")
               })

            ' Display results
            For Each attributeDataResult As UAAttributeDataResult In attributeDataResultArray
                If attributeDataResult.Succeeded Then
                    Console.WriteLine("AttributeData: {0}", attributeDataResult.AttributeData)
                Else
                    Console.WriteLine("*** Failure: {0}", attributeDataResult.ErrorMessageBrief)
                End If
            Next attributeDataResult

            ' Example output:
            '
            'AttributeData: 51 {System.Int16} @11/6/2011 1:49:19 PM @11/6/2011 1:49:19 PM; Good
            'AttributeData: -1993984 {System.Single} @11/6/2011 1:49:19 PM @11/6/2011 1:49:19 PM; Good
            'AttributeData: Yellow% Dragon Cat) White Blue Dog# Green Banana- {System.String} @11/6/2011 1:49:19 PM @11/6/2011 1:49:19 PM; Good            
        End Sub
    End Class
End Namespace
// This example shows how to read the attributes of 4 OPC-UA nodes specified by browse paths at once, and display the
// results.
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

using System;
using OpcLabs.EasyOpc.UA;
using OpcLabs.EasyOpc.UA.Navigation.Parsing;
using OpcLabs.EasyOpc.UA.OperationModel;

namespace UADocExamples._EasyUAClient
{
    partial class ReadMultiple
    {
        public static void BrowsePath()
        {
            UAEndpointDescriptor endpointDescriptor =
                "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer";
            // or "http://opcua.demo-this.com:51211/UA/SampleServer" (currently not supported)
            // or "https://opcua.demo-this.com:51212/UA/SampleServer/"

            // Instantiate the client object.
            var client = new EasyUAClient();

            // Instantiate the browse path parser.
            var browsePathParser = new UABrowsePathParser {DefaultNamespaceUriString = "http://test.org/UA/Data/"};

            // Prepare arguments.
            // Note: Add error handling around the following statement if the browse paths are not guaranteed to be
            // syntactically valid.
            var readArgumentsArray = new[]
            {
                new UAReadArguments(endpointDescriptor, 
                    browsePathParser.Parse("[ObjectsFolder]/Data/Dynamic/Scalar/FloatValue")),
                new UAReadArguments(endpointDescriptor,
                    browsePathParser.Parse("[ObjectsFolder]/Data/Dynamic/Scalar/SByteValue")),
                new UAReadArguments(endpointDescriptor,
                    browsePathParser.Parse("[ObjectsFolder]/Data/Static/Array/UInt16Value")),
                new UAReadArguments(endpointDescriptor,
                    browsePathParser.Parse("[ObjectsFolder]/Data/Static/UserScalar/Int32Value"))
            };

            // Obtain attribute data.
            UAAttributeDataResult[] attributeDataResultArray = client.ReadMultiple(readArgumentsArray);

            // Display results.
            for (int i = 0; i < attributeDataResultArray.Length; i++)
            {
                UAAttributeDataResult attributeDataResult = attributeDataResultArray[i];
                if (attributeDataResult.Succeeded)
                    Console.WriteLine($"results[{i}].AttributeData: {attributeDataResult.AttributeData}");
                else
                    Console.WriteLine($"results[{i}] *** Failure: {attributeDataResult.ErrorMessageBrief}");
            }
        }

        // Example output:
        //results[0].AttributeData: 4.187603E+21 {Single} @2019-11-09T14:05:46.268 @@2019-11-09T14:05:46.268; Good
        //results[1].AttributeData: -98 {Int16} @2019-11-09T14:05:46.268 @@2019-11-09T14:05:46.268; Good
        //results[2].AttributeData: [58] {38240, 11129, 64397, 22845, 30525, ...} {Int32[]} @2019-11-09T14:00:07.543 @@2019-11-09T14:05:46.268; Good
        //results[3].AttributeData: 1280120396 {Int32} @2019-11-09T14:00:07.590 @@2019-11-09T14:05:46.268; Good
    }
}
# This example shows how to read the attributes of 4 OPC-UA nodes specified by browse paths at once, and display the
# results.
#
# Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

#requires -Version 5.1
using namespace OpcLabs.EasyOpc.UA
using namespace OpcLabs.EasyOpc.UA.Navigation.Parsing
using namespace OpcLabs.EasyOpc.UA.OperationModel

# The path below assumes that the current directory is [ProductDir]/Examples-NET/PowerShell/Windows .
Add-Type -Path "../../../Components/Opclabs.QuickOpc/net472/OpcLabs.EasyOpcUA.dll"
Add-Type -Path "../../../Components/Opclabs.QuickOpc/net472/OpcLabs.EasyOpcUAComponents.dll"

[UAEndpointDescriptor]$endpointDescriptor =
    "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
# or "http://opcua.demo-this.com:51211/UA/SampleServer" (currently not supported)
# or "https://opcua.demo-this.com:51212/UA/SampleServer/"

# Instantiate the client object.
$client = New-Object EasyUAClient

# Instantiate the browse path parser.
$browsePathParser = New-Object UABrowsePathParser -Property @{DefaultNamespaceUriString = "http://test.org/UA/Data/"}

# Prepare arguments.
# Note: Add error handling around the following statement if the browse paths are not guaranteed to be
## syntactically valid.
$readArgumentsArray = @(
        (New-Object UAReadArguments($endpointDescriptor, 
            $browsePathParser.Parse("[ObjectsFolder]/Data/Dynamic/Scalar/FloatValue"))),
        (New-Object UAReadArguments($endpointDescriptor,
            $browsePathParser.Parse("[ObjectsFolder]/Data/Dynamic/Scalar/SByteValue"))),
        (New-Object UAReadArguments($endpointDescriptor,
            $browsePathParser.Parse("[ObjectsFolder]/Data/Static/Array/UInt16Value"))),
        (New-Object UAReadArguments($endpointDescriptor,
            $browsePathParser.Parse("[ObjectsFolder]/Data/Static/UserScalar/Int32Value")))
    )

# Obtain attribute data.
$attributeDataResultArray = $client.ReadMultiple($readArgumentsArray)

for ($i = 0; $i -lt $attributeDataResultArray.Length; $i++) {
    $attributeDataResult = $attributeDataResultArray[$i]
    if ($attributeDataResult.Succeeded) {
        Write-Host "results[$($i)].AttributeData: $($attributeDataResult.AttributeData)"
    }
    else {
        Write-Host "results[$($i)]: *** Failure: $($attributeDataResult.ErrorMessageBrief)"
    }
}


# Example output:
#
#results[0].AttributeData: 4.187603E+21 {Single} @2019-11-09T14:05:46.268 @@2019-11-09T14:05:46.268; Good
#results[1].AttributeData: -98 {Int16} @2019-11-09T14:05:46.268 @@2019-11-09T14:05:46.268; Good
#results[2].AttributeData: [58] {38240, 11129, 64397, 22845, 30525, ...} {Int32[]} @2019-11-09T14:00:07.543 @@2019-11-09T14:05:46.268; Good
#results[3].AttributeData: 1280120396 {Int32} @2019-11-09T14:00:07.590 @@2019-11-09T14:05:46.268; Good
# This example shows how to read the attributes of 4 OPC-UA nodes specified by browse paths at once, and display the
# results.
#
# Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
# OPC client and subscriber examples in Python on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-Python .
# The QuickOPC package is needed. Install it using "pip install opclabs_quickopc".
import opclabs_quickopc
import time

# Import .NET namespaces.
from OpcLabs.EasyOpc.UA import *
from OpcLabs.EasyOpc.UA.Navigation.Parsing import *
from OpcLabs.EasyOpc.UA.OperationModel import *


endpointDescriptor = UAEndpointDescriptor('opc.tcp://opcua.demo-this.com:51210/UA/SampleServer')
# or 'http://opcua.demo-this.com:51211/UA/SampleServer' (currently not supported)
# or 'https://opcua.demo-this.com:51212/UA/SampleServer/'

# Instantiate the client object.
client = EasyUAClient()

# Instantiate the browse path parser.
browsePathParser = UABrowsePathParser()
browsePathParser.DefaultNamespaceUriString = 'http://test.org/UA/Data/'

# Prepare arguments.
# Note: Add error handling around the following statement if the browse paths are not guaranteed to be
# syntactically valid.
readArgumentsArray = [
    UAReadArguments(endpointDescriptor,
                    UANodeDescriptor(browsePathParser.Parse('[ObjectsFolder]/Data/Dynamic/Scalar/FloatValue'))),
    UAReadArguments(endpointDescriptor,
                    UANodeDescriptor(browsePathParser.Parse('[ObjectsFolder]/Data/Dynamic/Scalar/SByteValue'))),
    UAReadArguments(endpointDescriptor,
                    UANodeDescriptor(browsePathParser.Parse('[ObjectsFolder]/Data/Static/Array/UInt16Value'))),
    UAReadArguments(endpointDescriptor,
                    UANodeDescriptor(browsePathParser.Parse('[ObjectsFolder]/Data/Static/UserScalar/Int32Value'))),
    ]

# Obtain attribute data.
attributeDataResultArray = client.ReadMultiple(readArgumentsArray)

# Display results.
for i, attributeDataResult in enumerate(attributeDataResultArray):
    if attributeDataResult.Succeeded:
        print('results[', i, '].AttributeData: ', attributeDataResult.AttributeData, sep='')
    else:
        print('results[', i, '] *** Failure: ', attributeDataResult.ErrorMessageBrief, sep='')

print()
print('Finished.')
' This example shows how to read the attributes of 4 OPC-UA nodes specified by browse paths at once, and display the
' results.
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Imports OpcLabs.EasyOpc.UA
Imports OpcLabs.EasyOpc.UA.Navigation.Parsing
Imports OpcLabs.EasyOpc.UA.OperationModel

Namespace _EasyUAClient
    Partial Friend Class ReadMultiple
        Public Shared Sub BrowsePath()

            ' Define which server we will work with.
            Dim endpointDescriptor As UAEndpointDescriptor =
                    "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
            ' or "http://opcua.demo-this.com:51211/UA/SampleServer" (currently not supported)
            ' or "https://opcua.demo-this.com:51212/UA/SampleServer/"

            ' Instantiate the client object
            Dim client = New EasyUAClient()

            Dim browsePathParser = New UABrowsePathParser()
            browsePathParser.DefaultNamespaceUriString = "http://test.org/UA/Data/"

            ' Prepare arguments
            ' Note: Add error handling around the following statement if the browse paths are Not guaranteed to be
            ' syntactically valid.
            Dim readArgumentsArray = New UAReadArguments() _
            {
                New UAReadArguments(endpointDescriptor,
                    browsePathParser.Parse("[ObjectsFolder]/Data/Dynamic/Scalar/FloatValue")),
                New UAReadArguments(endpointDescriptor,
                    browsePathParser.Parse("[ObjectsFolder]/Data/Dynamic/Scalar/SByteValue")),
                New UAReadArguments(endpointDescriptor,
                    browsePathParser.Parse("[ObjectsFolder]/Data/Static/Array/UInt16Value")),
                New UAReadArguments(endpointDescriptor,
                    browsePathParser.Parse("[ObjectsFolder]/Data/Static/UserScalar/Int32Value"))
            }


            ' Obtain attribute data. By default, the Value attributes of the nodes will be read.
            Dim resultArray() As UAAttributeDataResult = client.ReadMultiple(readArgumentsArray)

            ' Display results
            For i As Integer = 0 To resultArray.Length - 1
                Dim attributeDataResult As UAAttributeDataResult = resultArray(i)
                If attributeDataResult.Succeeded Then
                    Console.WriteLine("results[{0}].AttributeData: {1}", i, attributeDataResult.AttributeData)
                Else
                    Console.WriteLine("results[{0}]: *** Failure: {1}", i, attributeDataResult.ErrorMessageBrief)
                End If
            Next i

            ' Example output:
            'results[0].AttributeData 4.187603E+21 {System.Single} @2019-11-09T14:05:46.268 @@2019-11-09T14:05:46.268; Good
            'results[1].AttributeData: -98 {System.Int16} @2019-11-09T14:05:46.268 @@2019-11-09T14:05:46.268; Good
            'results[2].AttributeData: [58] {38240, 11129, 64397, 22845, 30525, ...} {System.Int32[]} @2019-11-09T14:00:07.543 @@2019-11-09T14:05:46.268; Good
            'results[3].AttributeData: 1280120396 {System.Int32} @2019-11-09T14:00:07.590 @@2019-11-09T14:05:46.268; Good
        End Sub
    End Class
End Namespace
// This example shows how to read the attributes of 4 OPC-UA nodes specified
// by browse paths at once, and display the results.
//
// Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

class procedure ReadMultiple.BrowsePath;
var
  Arguments: OleVariant;
  BrowsePathParser: _UABrowsePathParser;
  Client: OpcLabs_EasyOpcUA_TLB._EasyUAClient;
  I: Cardinal;
  ReadArguments1, ReadArguments2, ReadArguments3, ReadArguments4: _UAReadArguments;
  Result: _UAAttributeDataResult;
  Results: OleVariant;
begin
  BrowsePathParser := CoUABrowsePathParser.Create;
  BrowsePathParser.DefaultNamespaceUriString := 'http://test.org/UA/Data/';

  ReadArguments1 := CoUAReadArguments.Create;
  ReadArguments1.EndpointDescriptor.UrlString := 
    //'http://opcua.demo-this.com:51211/UA/SampleServer';
    //'https://opcua.demo-this.com:51212/UA/SampleServer/';
    'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer';
  //  Note: Add error handling around the following statement if the browse path is not guaranteed to be syntactically valid.
  ReadArguments1.NodeDescriptor.BrowsePath := BrowsePathParser.Parse('[ObjectsFolder]/Data/Dynamic/Scalar/FloatValue');

  ReadArguments2 := CoUAReadArguments.Create;
  ReadArguments2.EndpointDescriptor.UrlString := 
    //'http://opcua.demo-this.com:51211/UA/SampleServer';
    //'https://opcua.demo-this.com:51212/UA/SampleServer/';
    'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer';
  //  Note: Add error handling around the following statement if the browse path is not guaranteed to be syntactically valid.
  ReadArguments2.NodeDescriptor.BrowsePath := BrowsePathParser.Parse('[ObjectsFolder]/Data/Dynamic/Scalar/SByteValue');

  ReadArguments3 := CoUAReadArguments.Create;
  ReadArguments3.EndpointDescriptor.UrlString := 
    //'http://opcua.demo-this.com:51211/UA/SampleServer';
    //'https://opcua.demo-this.com:51212/UA/SampleServer/';
    'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer';
  //  Note: Add error handling around the following statement if the browse path is not guaranteed to be syntactically valid.
  ReadArguments3.NodeDescriptor.BrowsePath := BrowsePathParser.Parse('[ObjectsFolder]/Data/Static/Array/UInt16Value');

  ReadArguments4 := CoUAReadArguments.Create;
  ReadArguments4.EndpointDescriptor.UrlString := 
    //'http://opcua.demo-this.com:51211/UA/SampleServer';
    //'https://opcua.demo-this.com:51212/UA/SampleServer/';
    'opc.tcp://opcua.demo-this.com:51210/UA/SampleServer';
  //  Note: Add error handling around the following statement if the browse path is not guaranteed to be syntactically valid.
  ReadArguments4.NodeDescriptor.BrowsePath := BrowsePathParser.Parse('[ObjectsFolder]/Data/Static/UserScalar/Int32Value');

  Arguments := VarArrayCreate([0, 3], varVariant);
  Arguments[0] := ReadArguments1;
  Arguments[1] := ReadArguments2;
  Arguments[2] := ReadArguments3;
  Arguments[3] := ReadArguments4;

  // Instantiate the client object
  Client := CoEasyUAClient.Create;

  // Perform the operation
  TVarData(Results).VType := varArray or varVariant;
  TVarData(Results).VArray := PVarArray(Client.ReadMultiple(Arguments));

  // Display results
  for I := VarArrayLowBound(Results, 1) to VarArrayHighBound(Results, 1) do
  begin
    Result := IInterface(Results[I]) as _UAAttributeDataResult;
    if Result.Succeeded then
      WriteLn('results[', I, '].AttributeData: ', Result.AttributeData.ToString)
    else
      WriteLn('results[', I, '] *** Failure: ', Result.ErrorMessageBrief);
  end;

  VarClear(Results);
  VarClear(Arguments);

  // Example output:
  //results[0].AttributeData: 4.187603E+21 {System.Single} @2019-11-09T14:05:46.268 @@2019-11-09T14:05:46.268; Good
  //results[1].AttributeData: -98 {System.Int16} @2019-11-09T14:05:46.268 @@2019-11-09T14:05:46.268; Good
  //results[2].AttributeData: [58] {38240, 11129, 64397, 22845, 30525, ...} {System.Int32[]} @2019-11-09T14:00:07.543 @@2019-11-09T14:05:46.268; Good
  //results[3].AttributeData: 1280120396 {System.Int32} @2019-11-09T14:00:07.590 @@2019-11-09T14:05:46.268; Good

end;
// This example shows how to read data value of 3 nodes at once, from the device (data source).
//
// Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

using System;
using OpcLabs.EasyOpc.UA;
using OpcLabs.EasyOpc.UA.OperationModel;

namespace UADocExamples._EasyUAClient
{
    partial class ReadMultiple
    {
        public static void FromDevice()
        {
            UAEndpointDescriptor endpointDescriptor =
                "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer";
            // or "http://opcua.demo-this.com:51211/UA/SampleServer" (currently not supported)
            // or "https://opcua.demo-this.com:51212/UA/SampleServer/"

            // Instantiate the client object
            var client = new EasyUAClient();

            // Obtain attribute data. By default, the Value attributes of the nodes will be read.
            // The parameters specify reading from the device (data source), which may be slow but provides the very latest
            // data.
            UAAttributeDataResult[] attributeDataResultArray = client.ReadMultiple(new[]
                {
                    new UAReadArguments(endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10845", 
                        UAReadParameters.FromDevice),
                    new UAReadArguments(endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10853", 
                        UAReadParameters.FromDevice),
                    new UAReadArguments(endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10855", 
                        UAReadParameters.FromDevice)
                });

            // Display results
            foreach (UAAttributeDataResult attributeDataResult in attributeDataResultArray)
            {
                if (attributeDataResult.Succeeded)
                    Console.WriteLine("AttributeData: {0}", attributeDataResult.AttributeData);
                else
                    Console.WriteLine("*** Failure: {0}", attributeDataResult.ErrorMessageBrief);
            }
        }

        // Example output:
        //
        //AttributeData: 51 {System.Int16} @11/6/2011 1:49:19 PM @11/6/2011 1:49:19 PM; Good
        //AttributeData: -1993984 {System.Single} @11/6/2011 1:49:19 PM @11/6/2011 1:49:19 PM; Good
        //AttributeData: Yellow% Dragon Cat) White Blue Dog# Green Banana- {System.String} @11/6/2011 1:49:19 PM @11/6/2011 1:49:19 PM; Good            
    }
}
# This example shows how to read data value of 3 nodes at once, from the device (data source).
#
# Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .
# OPC client and subscriber examples in Python on GitHub: https://github.com/OPCLabs/Examples-QuickOPC-Python .
# The QuickOPC package is needed. Install it using "pip install opclabs_quickopc".
import opclabs_quickopc
import time

# Import .NET namespaces.
from OpcLabs.EasyOpc.UA import *
from OpcLabs.EasyOpc.UA.OperationModel import *


endpointDescriptor = UAEndpointDescriptor('opc.tcp://opcua.demo-this.com:51210/UA/SampleServer')
# or 'http://opcua.demo-this.com:51211/UA/SampleServer' (currently not supported)
# or 'https://opcua.demo-this.com:51212/UA/SampleServer/'

# Instantiate the client object.
client = EasyUAClient()

# Obtain attribute data. By default, the Value attributes of the nodes will be read.
# The parameters specify reading from the device (data source), which may be slow but provides the very latest
# data.
attributeDataResultArray = client.ReadMultiple([
    UAReadArguments(endpointDescriptor, UANodeDescriptor('nsu=http://test.org/UA/Data/ ;i=10845'),
                    UAReadParameters.FromDevice),
    UAReadArguments(endpointDescriptor, UANodeDescriptor('nsu=http://test.org/UA/Data/ ;i=10853'),
                    UAReadParameters.FromDevice),
    UAReadArguments(endpointDescriptor, UANodeDescriptor('nsu=http://test.org/UA/Data/ ;i=10855'),
                    UAReadParameters.FromDevice),
    ])

# Display results.
for attributeDataResult in attributeDataResultArray:
    if attributeDataResult.Succeeded:
        print('AttributeData: ', attributeDataResult.AttributeData, sep='')
    else:
        print('*** Failure: ', attributeDataResult.ErrorMessageBrief, sep='')

print()
print('Finished.')
' This example shows how to read data value of 3 nodes at once, from the device (data source).
'
' Find all latest examples here: https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

Imports OpcLabs.EasyOpc.UA
Imports OpcLabs.EasyOpc.UA.OperationModel

Namespace _EasyUAClient
    Partial Friend Class ReadMultiple
        Public Shared Sub FromDevice()

            ' Define which server we will work with.
            Dim endpointDescriptor As UAEndpointDescriptor =
                    "opc.tcp://opcua.demo-this.com:51210/UA/SampleServer"
            ' or "http://opcua.demo-this.com:51211/UA/SampleServer" (currently not supported)
            ' or "https://opcua.demo-this.com:51212/UA/SampleServer/"

            ' Instantiate the client object
            Dim client = New EasyUAClient()

            ' Obtain attribute data. By default, the Value attributes of the nodes will be read.
            ' The parameters specify reading from the device (data source), which may be slow but provides the very latest
            ' data.
            Dim attributeDataResultArray() As UAAttributeDataResult = client.ReadMultiple(New UAReadArguments() _
               {
                   New UAReadArguments(endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10845",
                        UAReadParameters.FromDevice),
                    New UAReadArguments(endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10853",
                        UAReadParameters.FromDevice),
                    New UAReadArguments(endpointDescriptor, "nsu=http://test.org/UA/Data/ ;i=10855",
                        UAReadParameters.FromDevice)
               })

            ' Display results
            For Each attributeDataResult As UAAttributeDataResult In attributeDataResultArray
                If attributeDataResult.Succeeded Then
                    Console.WriteLine("AttributeData: {0}", attributeDataResult.AttributeData)
                Else
                    Console.WriteLine("*** Failure: {0}", attributeDataResult.ErrorMessageBrief)
                End If
            Next attributeDataResult

            ' Example output:
            '
            'AttributeData: 51 {System.Int16} @11/6/2011 1:49:19 PM @11/6/2011 1:49:19 PM; Good
            'AttributeData: -1993984 {System.Single} @11/6/2011 1:49:19 PM @11/6/2011 1:49:19 PM; Good
            'AttributeData: Yellow% Dragon Cat) White Blue Dog# Green Banana- {System.String} @11/6/2011 1:49:19 PM @11/6/2011 1:49:19 PM; Good            
        End Sub
    End Class
End Namespace
Requirements

Target Platforms: .NET Framework: Windows 10 (selected versions), Windows 11 (selected versions), Windows Server 2016, Windows Server 2022; .NET: Linux, macOS, Microsoft Windows

See Also