2 Replies Latest reply on Mar 24, 2015 9:04 PM by dng

    How to create a AF Hierarchy from a Business Production Hierarchy in SQL Server.


      Dear PI Square Community,


      We have the company production Data Warehouse based on SQL Server. Now, we want to replicate the master business production Hierarchy into AF Server to have AF as the official hierarchy for PI application development (Coresight, Processbook, PI WebParts, etc). As we have to develop a custom code to replicate the Data Warehouse hierarchy into AF, then we would be grateful if you can guide us selecting the best tools to do so. So far, we are thinking of having .NET calling the PIAF SDK libraries to do so but we are not sure. Thus, based on this could you please provide us the following:


      1. What approach o you recommended to do so?

      2. is there any documentation or tutorial about using PI AF SDK. If so, can you provide it to us.


      Looking forward to hearing from you soon,


      Thanks & Regards,


      Daniel Davalillo

      Chevron ETC

        • Re: How to create a AF Hierarchy from a Business Production Hierarchy in SQL Server.

          Hi Daniel,


          I noticed you opened up Tech Support Case # 617844 for this issue. Do you have any additional questions after working with our Tech Support Engineer?


          We do have a few Developer Tools that can be used to interact with both SQL and AF server. However, most of them (e.g. PI OLEDB Enterprise) only allow read access to the AF database. As you have mentioned, PI AF SDK will be a valid option for your use case since it allows both read/write access and offers a variety of functionality. You also mentioned that the production hierarchy could change, so a custom .NET application could update the AF hierarchy when any change has happened.


          Apart from the AF SDK tutorials in the Master PI space, do download the AF SDK Developer tools from the Tech Support download center (related discussion here: PI AF SDK Programming References). After installation, you can find the full list of AF SDK programming references at %pihome%\help\afsdk.chm.

          Hope it helps! Do keep us in the loop and we will be happy to answer any specific development questions you have.

            • Re: How to create a AF Hierarchy from a Business Production Hierarchy in SQL Server.

              Hi Daniel,


              I received a response to this thread in the general PI Square mailbox instead of from the forum. In general, the forum space is highly monitored (as compared to the PI Square mailbox), so you will get a faster response if replying to this thread directly! Nonetheless, I have pasted your questions and my answers for continued discussion in this forum:




              Here our focus is to generate an AF Hierarchy  Database based on the official company production business hierarchy which is on SQL server. Now, we want to know from you the following:


              1. Which program language do you recommend to work along PI AF SDK? Can we use Visual Studio C#? Please let us know.

              2. Where we can find how to reference the AF elements to be created to build the hierarchy? We can find it in the AF SDK tutorials. By chance do you have any code as example to do so.




              To answer your questions:


              1. Since PI AF SDK is built as a .NET library, I would recommend using a .NET language while working with PI AF SDK. C# is definitely the most common language I have seen so far; alternatively, I have also seen some instances of VB.NET. I would definitely recommend C#, but this ultimately depends on the comfort level and preference of the developer.


              2. There are many sample codes in the AF SDK reference guide (available at %pihome%\help\afsdk.chm after installing the AF Developer Tools). Specifically, you will want to look at the examples under the following classes within the AF.Asset namespace for examples on how to create elements, attributes and templates:

              • AFElement
              • AFAttribute
              • AFElementTemplate
              • AFAttributeTemplate


              If you have specific development questions, I will also be able to provide more code samples.


              Hope it helps! Let me know if you have any questions.