Option to reconcile templates during xml import
Suppose the following scenario: a user has 2 AF databases (a development and a production one), both containing same version of a template. The user deletes a few attributes and analyses from one element template (development), exports the xml and imports the same xml file into the production database. Today, the template in the production server remains unchanged, forcing the user to manually delete the attributes and analyses from production database (using either PI Builder or PSE).
The "import xml" function present in PI System Explorer should contain an option to allow users to reconcile templates, when importing a template into a system that contain the same template name. When that option is set, attributes and analyses that do not exist in the xml file should be deleted from the corresponding template (i.e., template with same name) in the database where the xml file is being imported.
So what would be the expected behavior if elements have already been created from the template? It would then be possible to have deletion of data upon an import of a template. What if there are overridden template attributes? What would be the expected behavior if the imported template affects these overridden template attributes?
James Lewis commented
In answer to Stephen's questions, I don't think there needs to be any special handling for these scenarios. The normal affect on elements of deleting their attribute and analysis templates should apply. I have created a similar request, but it also covers other object types, not just templates - https://feedback.osisoft.com/forums/555148-pi-server/suggestions/38566315-xml-export-import-to-support-object-deletion
Fabiano Batista commented
The expected behavior is to have the elements containing the same attributes as their templates, so if attributes are deleted from the template, they will be removed from the elements. This is what we expect when deploying templates from a dev database into a production database.
Regarding the question about overridden attributes, this is more related to the design of the AF templates in the first place. During a deployment task, we need to make sure the templates in the production database contain the same attributes as int the development database. So, after verifying the changes performed on dev database templates are good, by deploying those modified templates on production database should work correctly (considering the reconciliation step is applied to delete attributes and analyses that are no longer required).
I usually perform reconciliation of AF templates manually during a typical AF deployment task (using Excel formulas and PI Builder), but is very time consuming operation. If we had this option implemented in PSE, it would take me seconds.
Of course there are other things that need reconciliation (element hierarchy, UOM, etc.), but addressing the templates first one would be a good start and reduce a lot the complexity of a typical AF deployment activity.