2 Replies Latest reply on Oct 4, 2018 11:55 AM by Archit

    How can I use a child attribute named 'Tagname' to connect to a PI Point from its parent attribute?

    Rick Davin

      Rick Davin asking on behalf of Archit Garg

      Asked as a splinter thread inside an older thread here:  https://pisquare.osisoft.com/thread/35720-get-the-tag-name-from-af-attribute#111299


      Question:     Can you tell me how to "have a static child attribute named "Tagname" under the attribute named "PIPoint", and they use the value in Tagname to connect to PIPoint."?

        • Re: How can I use a child attribute named 'Tagname' to connect to a PI Point from with its parent attribute?
          Rick Davin

          Hi Archit,


          Welcome to the PI Square community!  Since you are quite new here, I am going to answer you question.  However, for the record it is generally not sound advice to ask a question inside an older post that already has a marked answer.  For one, since it is an answered question, it may not receive as much traffic (or interested eyeballs).  Another reason is that it creates a side discussion that in its own right should be its own question.  That way, when your question has been answered satisfactorily, you may mark the new thread as being answered.


          First, let's start with some of the standard sample tags installed with almost every PI Data Archive (PIDA).  I am only interested in those belonging to Batch Reactor 1.  If you use the tool SMT (also known as PI System Management Tools), you may see the following tags on your PIDA.


          Tag NameDescriptor
          BA:ACTIVE.1Batch Active Reactor 1
          BA:CONC.1Concentration Reactor 1
          BA:LEVEL.1Level Reactor 1
          BA:PHASE.1Phase Reactor 1
          BA:TEMP.1Temperature Reactor 1


          Let's make a Batch Reactor element template for an AF database.  We will name this "Batch Reactor Template".  Your energy will be in creating this template, and later you can create an element using this template.  The element will be named "Batch Reactor 1".  There are many ways to do all this but for the question at hand, I am focusing on the child attribute named "Tagname" in this design.


          Here's a shot of the root level attributes:


          2018-10-04 05_46_26-Window.png


          A few of things to observe.  Clearly all except 1 are tags, and you can see that current values are shown.  This clearly is what you are learning about, so bear with me.


          Note the attribute names are not tied to the specific reactor number.  In other words, it's not "BA:CONC.1" or "Concentration 1".  Rather, it's "Concentration" because its element (asset) is called "Batch Reactor 1".  Imagine if I commissioned a "Batch Reactor 2", that I would use the same attribute names but re-map the tag name being used to point to reactor 2's tags.  If you were to expand the path name in a spreadsheet, it would be:


          \Batch Reactor 1|Concentration


          Another thing to note is "PI Data Archive".  In this design it is a static string attribute.  It could also be a StringBuilder or Table Lookup attribute.  For this example, where the focus will be on the tag naming, it was easier to use a simple static string for the PI Data Archive.  You are free to name it other things like "PIDA" or "Data Server" or other.


          Here's an expanded view of the element:


          2018-10-04 05_47_54-Window.png


          Note each attribute being mapped to a PI point has a child attribute named "Tagname".  Each is a static string mapped to just the tag name portion of the point name.  The server name portion is already known from "|PI Data Archive".


          The real magic of making the connection now is the PIPoint ConfigString for the root level attribute.  Due to the design of this example template, each PIPoint has the same configuration string!


          \\%@|PI Data Archive%\%@.|Tagname%


          The server name is provided by:      %@|PI Data Archive%


          The tag name is provided by:          %@.|Tagname%


          Let me know if this answers your question.  Good luck!