Cannot instantiate Optional Variable Properties.
Posted: 09 Dec 2020, 13:57
Hello,
I have already been through this forum already and found 2/3 questions related to this but somehow solution is not working for me.
In my Information Model, I have several variable properties under an object type. However, only one property is mandatory and rest are all optional. How can I instantiate the optional properties (an example would be of great help).
Do I use optionalbrowsepath in my createobjectsettings like this ?
CreateObjectSettings settings = new CreateObjectSettings()
{
ParentNodeId = UnifiedAutomation.UaBase.ObjectIds.ObjectsFolder,
ReferenceTypeId = UnifiedAutomation.UaBase.ReferenceTypeIds.Organizes,
RequestedNodeId = new NodeId(DepartmentA, DefaultNamespaceIndex),
BrowseName = new QualifiedName(DepartmentA, DefaultNamespaceIndex),
TypeDefinitionId = new NodeId(MyA.MyAIm.ObjectTypes.BodyShopProEType, DefaultNamespaceIndex),
OptionalBrowsePaths = new List<string> { AbsoluteName.ToString(BrowseNames.CounterPerType, BrowseNames.CounterTotal)}
};
ObjectNode DepartmentANode = CreateObject(Server.DefaultRequestContext, settings);
Note: in my IM: the optional nodes are located in a Object called ProdData in Object Type BodyShopProEType
with this, I do not get optional properties in UA Expert.
Furthermore, as you have mentioned to use CreateInstanceSetting, an example of it's structure(syntax) would make things more clear ?
Looking forward to your suggestions...
Regards,
Ali
I have already been through this forum already and found 2/3 questions related to this but somehow solution is not working for me.
In my Information Model, I have several variable properties under an object type. However, only one property is mandatory and rest are all optional. How can I instantiate the optional properties (an example would be of great help).
Do I use optionalbrowsepath in my createobjectsettings like this ?
CreateObjectSettings settings = new CreateObjectSettings()
{
ParentNodeId = UnifiedAutomation.UaBase.ObjectIds.ObjectsFolder,
ReferenceTypeId = UnifiedAutomation.UaBase.ReferenceTypeIds.Organizes,
RequestedNodeId = new NodeId(DepartmentA, DefaultNamespaceIndex),
BrowseName = new QualifiedName(DepartmentA, DefaultNamespaceIndex),
TypeDefinitionId = new NodeId(MyA.MyAIm.ObjectTypes.BodyShopProEType, DefaultNamespaceIndex),
OptionalBrowsePaths = new List<string> { AbsoluteName.ToString(BrowseNames.CounterPerType, BrowseNames.CounterTotal)}
};
ObjectNode DepartmentANode = CreateObject(Server.DefaultRequestContext, settings);
Note: in my IM: the optional nodes are located in a Object called ProdData in Object Type BodyShopProEType
with this, I do not get optional properties in UA Expert.
Furthermore, as you have mentioned to use CreateInstanceSetting, an example of it's structure(syntax) would make things more clear ?
Looking forward to your suggestions...
Regards,
Ali