At model change, get the name of the affected node

Questions regarding the use of the .NET SDK 2.0 for Server or Client development or integration into customer products ...

Moderator: uasdknet

Post Reply
MartinO
Jr. Member
Jr. Member
Posts: 3
Joined: 17 Nov 2017, 08:47

At model change, get the name of the affected node

Post by MartinO »

Hi,

When subscribing to model change events. How can I get the BrowseName or DisplayName of the affected node?

I can get the nodeId from the BrowseNames.Changes and the parent node name from BrowseNames.SourceName. But I can not figure out how to get the name of the affected node.

I have tried BrowseNames.Name and BrowseNames.EffectiveDisplayName but the all return null.

string parentName = changeEvent.MonitoredItem.Filter.GetValue<string>(changeEvent.Event, BrowseNames.SourceName, "null"); // Returns the name of the parent node

string name = changeEvent.MonitoredItem.Filter.GetValue<string>(changeEvent.Event, BrowseNames.Name, "null"); // Returns "null"
string ename = changeEvent.MonitoredItem.Filter.GetValue<string>(changeEvent.Event, BrowseNames.EffectiveDisplayName, "null"); // Returns "null"

BR,
-Martin

User avatar
Support Team
Hero Member
Hero Member
Posts: 3068
Joined: 18 Mar 2011, 15:09

Re: At model change, get the name of the affected node

Post by Support Team »

Hello Martin,

you cannot get the BrowseName of the affected node directly. You need to add the EventField "Changes" to the SelectClauses. The Datatype of this event field is ModelChangeStructureDataType. The structure field Affected represents the NodeId of the affected node. You can use the Read service to get the BrowseName.
Best regards
Unified Automation Support Team

Post Reply