EcoStruxure Geo SCADA Expert Forum
Schneider Electric support forum about installation, configuration, integration and troubleshooting of EcoStruxure Geo SCADA Expert (ClearSCADA, ViewX, WebX).
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-11-23 05:21 PM . Last Modified: 2023-05-03 12:00 AM
Is it possible to get the corresponding template name or Id of an Instance through the Automation Interface? My goal is to be able to find out if a property is overridden in the template
My code snippet is
InstanceFullName = "ParentGroup.InstanceName"
Set obj = server.FindObject(InstanceFullName)
TemplateId = obj.TemplateId
InstanceId = obj.InstanceId
I see that TemplateId is always 0 but InstanceId gives me the Id of ParentGroup if ParentGroup is another Template Instance otherwise I get 0
Eventually I would like to execute the following method on a few property names
tobj.PropertyOverride(TemplateId, PropertyName) (tobj -> Item inside the template)
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-11-24 08:15 PM
I think you'll probably want the 'ParentTemplateId' property.
Which is described as "Reference to the template containing the object, if any."
So if the object has a ParentTemplateId that is not -1 then it is from a template, and you could reference the ID to obtain that template.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-11-29 09:49 AM
I don't see a ParentTemplateId method for SCXV6Object. I think you might have referred to the Property ParentTemplateId. I get -1 for both for an independent object( not part of any template) or a template object. I think the reason could be because the object I am checking is inside a template instance. So when I try ParentInstanceId, I get the "Id" of the Parent Group Instance.
I think I can work with this idea:
Lets say obj is the object for which I have to check if a property is overridden
1. Get the Parent Instance Id : obj.Property("ParentInstanceId")
2. Find the corresponding Group Object:
3. Get the Template Id property from the Group Object ( we cant use this on obj because it will fail)
4. Find the Corresponding Template Object ( tObj )
5. Use the Find method under SCXV6Object to see if the Instance Name ( obj.Name ) exists in the template
6. If it exists then use the PropertyOverride method: tObj.PropertyOverride( tpObj.Id, propertyName). This would return either TRUE or FALSE
tpObj would be Nothing if obj.Name doesn't exist in the Template
Thanks!!
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-11-29 01:41 PM
I don't see a ParentTemplateId method for SCXV6Object. I think you might have referred to the Property ParentTemplateId.
Huh? Wasn't my first sentence exactly this.. "I think you'll probably want the 'ParentTemplateId' property."
But yes, my mistake, the ParentTemplateId property applies to tell if a point is within a Template (and which Template), not whether it is within an Instance of a Template. So it is the 'ParentInstanceId' property you would want.
ParentInstanceId should return you the ID of the CTemplateInstance in which your object is located (if it is associated with an instance).
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2021-11-29 01:51 PM
Ah !! I overlooked it, my bad.
Thanks for your suggestion
Link copied. Please paste this link to share this article on your social media post.
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.