Closed VictorPieper closed 1 year ago
I figured it out sort off so better answer are still appreciated (:
Using: var references = session.FetchReferences(nodeId);
You can get all references from a node.
foreach (var ref3 in refs3.Where(n => n.DisplayName != "Icon"))
{
NodeId nodeId = new NodeId(ref3.NodeId.ToString());
var value = session.ReadValue(nodeId);
Console.WriteLine("----------------------");
Console.WriteLine("Node+ {0}: {1}, {2}, NodeId = {3}, Value = {4}", ref3.DisplayName, ref3.BrowseName, ref3.NodeClass, ref3.NodeId, value);
var references = session.FetchReferences(nodeId);
if (references != null)
{
Console.WriteLine("array");
foreach (var reference in references.Where(r => r.NodeClass.ToString() == "Variable"))
{
Console.WriteLine(reference.BrowseName + " NodeId: " + reference.NodeId.ToString());
}
}
Console.WriteLine("----------------------");
}
Output:
Node+ read: 4:read, Variable, NodeId = ns=4;i=2, Value = (null)
array
4:[0] NodeId: ns=4;i=3
4:[1] NodeId: ns=4;i=4
4:[2] NodeId: ns=4;i=5
4:[3] NodeId: ns=4;i=6
Please check the console samples how to browse and read values efficiently, especially how to browse or fetch the whole tree: https://github.com/OPCFoundation/UA-.NETStandard/blob/master/Applications/ConsoleReferenceClient/ClientSamples.cs
Apparently there is a ReadValues
API that reads the values in a single service call, that is preferred operation.
Type of issue
Current Behavior
My test console program to browse into nodes gives me this output:
The node 'read' is an array of 4 Dints
Expected Behavior
This is what I expect:
I want the array nodes listed aswell
Steps To Reproduce
Environment
Anything else?
This code snippet is for step 2:
Extra info: