12 Replies Latest reply on Nov 1, 2016 1:30 PM by Asle Frantzen

    Importing a hierarchy exported from one server in to another.

    StuartHemming

      I've written a small console app that creates a new AF database and imports a number of elements in to the Library. The idea is to create a new DB in a known state for people to run tests on.

       

      Everything works as it should. Then I was asked if we could import a hierarchy in to Elements to save the testers setting everything up from scratch.

       

      That seemed straightforward and an import of the exported file seems to do exactly what has been asked of it.

       

      However, I noticed when looking at the results, that the ConfigString for each of the imported elements is that from the server/database that it was exported from.

       

      And so to my question: How do I import a hierarchy of elements and have the ConfigString set correctly based on the server/database that it is being imported into. I really don't want to have to do some regex search and replace on the XML file before importing it. Is there a way of getting the ConfigString Tempate on the attribute (which looks something like this...

       

      <ConfigString>\\%@\PI Data Archive Server|Name%\%database%.%..\..\..\..\..\..\..\..\..\Element%.%..\..\..\..\..\..\..\..\Element%.%..\..\..\..\..\..\..\Element%.%..\..\..\..\..\..\Element%.%..\..\..\..\..\Element%.%..\..\..\..\Element%.%..\..\..\Element%.%..\..\Element%.%..\Element%.%Element%.%Attribute%;ReadOnly=False;pointtype=Int16</ConfigString>

       

      reapplied to the items in the element hierarchy?