Not sure if i understand the issue. If you have tag creation attributes in your template, the instantiation of the template in an element will ensure the tag attributes are generated. Only thing you need is to create or update PI Points: Reset attribute to template and create the PI point
Reset to template: PI AF - Reset to Template in Bulk
Ya, sorry, I should have been more straigh forward. I want to do the same function as "Create or Update Data Reference" in PSE. I've done some looking around and come up with this:
AFElement parentElement = AFObject.FindObject(pathDefault) as AFElement;
AFElement myElement = parentElement.Elements.Add("My Element Name", myElementTemplate);
foreach (AFAttribute CurAttribute in myElement.Attributes)
But when i run this, i get an error, more of a c# error I believe,
" An unhandled exception of type 'System.NullReferenceException' occurred in AFIntegratorAndSNMP.exe
Additional information: Object reference not set to an instance of an object."
Any help with this error would be appreciated.
1 of 1 people found this helpful
For anyone in the future that runs into something like this, where it looks like some code should be working but it's not, one thing to check would be to make sure that the "Optimize Code" checkbox is unchecked under project properties. For some reason, VS 2015 was removing a variable or deactivating it, or something, and unchecking this option fixed this error for me, and attributes were successfully built.
Not sure if I should link to other pages from here, but I found my answer here.
Thanks for your help as well Roger Palmen.
Glad you found the answer to your question and thanks for sharing the link that helped you to resolve it!
Do you have any more questions on this topic?