OPC Studio User's Guide and Reference
BrowseDataVariables Method (_EasyUAClient)
Example 



View with Navigation Tools
OpcLabs.EasyOpcUA Assembly > OpcLabs.EasyOpc.UA.ComTypes Namespace > _EasyUAClient Interface : BrowseDataVariables Method
Endpoint descriptor. Identifies the OPC-UA server.
Node descriptor. Identifies the node in OPC server's address space.
Browses the Data Variables, specifying an endpoint descriptor, and a starting Node Id.
Syntax
'Declaration
 
<ElementsNotNullAttribute()>
<NotNullAttribute()>
Function BrowseDataVariables( _
   ByVal endpointDescriptorString As String, _
   ByVal nodeDescriptorString As String _
) As UANodeElementCollection
 
'Usage
 
Dim instance As _EasyUAClient
Dim endpointDescriptorString As String
Dim nodeDescriptorString As String
Dim value As UANodeElementCollection
 
value = instance.BrowseDataVariables(endpointDescriptorString, nodeDescriptorString)

Parameters

endpointDescriptorString
Endpoint descriptor. Identifies the OPC-UA server.
nodeDescriptorString
Node descriptor. Identifies the node in OPC server's address space.

Return Value

The method returns a node element collection, which contains OpcLabs.EasyOpc.UA.AddressSpace.UANodeElement values. Each element contains information about a particular node found.
Example

COM

// This example shows how to obtain data variables under the "Server" node
// in the address space.
//
// Find all latest examples here : https://opclabs.doc-that.com/files/onlinedocs/OPCLabs-OpcStudio/Latest/examples.html .

class procedure BrowseDataVariables.Main;
var
  Client: OpcLabs_EasyOpcUA_TLB._EasyUAClient;
  Count: Cardinal;
  Element: OleVariant;
  EndpointDescriptor: string;
  NodeElement: _UANodeElement;
  NodeElementEnumerator: IEnumVariant;
  NodeElements: _UANodeElementCollection;
  ServerNodeId: _UANodeId;
begin
  EndpointDescriptor := 
    //'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';

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

  // Obtain variables under "Server" node
  ServerNodeId := CoUANodeId.Create;
  ServerNodeId.StandardName := 'Server';
  try
    NodeElements := Client.BrowseDataVariables(EndpointDescriptor, ServerNodeId.ExpandedText);
  except
    on E: EOleException do
    begin
      WriteLn(Format('*** Failure: %s', [E.GetBaseException.Message]));
      Exit;
    end;
  end;

  // Display results
  NodeElementEnumerator := NodeElements.GetEnumerator;
  while (NodeElementEnumerator.Next(1, Element, Count) = S_OK) do
  begin
    NodeElement := IUnknown(Element) as _UANodeElement;
    WriteLn;
    WriteLn('nodeElement.NodeId: ', NodeElement.NodeId.ToString);
    WriteLn('nodeElement.NodeId.ExpandedText: ', NodeElement.NodeId.ExpandedText);
    WriteLn('nodeElement.DisplayName: ', NodeElement.DisplayName);
  end;

  // Example output:
  //
  //nodeElement.NodeId: Server_ServerStatus
  //nodeElement.NodeId.ExpandedText: nsu=http://opcfoundation.org/UA/ ;i=2256
  //nodeElement.DisplayName: ServerStatus
end;
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