5 Replies Latest reply on Sep 23, 2016 6:52 AM by Roger Palmen

    Does anyone know any way to reference a child element attribute (no PIPoint type) from Analytics?

    PabloMatia

      I've seen several entries,

           for example:

           Substitution Parameters in AF Analyses     

       

      but no one of them refer to attributes that are not PIPoint type.

      The structure has a parent with some children.

      The parent’s element has an attribute type "string" (loaded in the implementation time of the structure) that indicates the name of the child element which I intend
      to reference.

      Child elements have attributes that are results of analyses performed at that level, the parent need retrieve these results, to perform other analyses.

      The reference in parent analyses, should use the string attribute to refer the child element.

       

      Is this possible?

       

      Thanks in advance

       

      Pablo

        • Re: Does anyone know any way to reference a child element attribute (no PIPoint type) from Analytics?
          Rick Davin

          Hi Pablo,

           

          I understand that the parent element has a string attribute that (1) is not a PIPoint and (2) contains the name of child element.

           

          For the attribute on the child element, is it a PIPoint?  I see you used the plural analyses and results so I am hoping you are historizing the calculations.  I also assume this attribute on a child element is named the same on all potential child elements?

           

          Regards,

          Rick

            • Re: Does anyone know any way to reference a child element attribute (no PIPoint type) from Analytics?
              PabloMatia

              Hi Rick

              Thank you very much for your answer.

               

              You are right, the parent has a string attribute, where, in the configuration time, I will write the name off the child element.

               

              The attribute in the child element is not a PIPoint. (this is my problem)

               

              The child elements perform some analyses, the results of them are written in attributes without history; except for the attributes that belongs to the elements that was indicated in the parent’s string’s attributes.

               

               

              All the child elements belongs the same template.

               

              Regards

                • Re: Does anyone know any way to reference a child element attribute (no PIPoint type) from Analytics?
                  Roger Palmen

                  Controlling the behaviour of an analysis to write to history PI Points or not can only be done in design-time, not runtime. So you can't switch which child element will write history from another attribute.

                  If tried to be creative with the string builder, because that is the only DataReference that lets you work on string attributes. But nothing really worked to compare the parent element attribute value with the current element's name.

                   

                  So going the NoOutput route on the analysis this worked for me:

                  • One string builder attribute "MyName": "%Element%";
                  • One string builder attribute "ChildToWrite" taking the attribute value from the parent: '..\|NameOfChild'
                  • And one analysis: if ('ChildToWrite' = 'MyName') then 1 else NoOutput()

                   

                  If the use of NoOutput() does not fit your scenario, please share some details on what you try to achieve functionally so we can have a look for alternate solutions.

                  1 of 1 people found this helpful
              • Re: Does anyone know any way to reference a child element attribute (no PIPoint type) from Analytics?
                Rick Davin

                I was playing around with this some more and may have found an undocumented feature of Asset Analytics.  Let me also offer a strong warning: this feature may not be available in future versions of Analytics, and your analysis must be periodic since a change in the source value does not trigger a change in the pointer name.

                 

                Let's look at some attributes on the parent element:

                2016-09-22 09_56_16-__RDAVIN7250_Analytics Examples - PI System Explorer.png

                 

                The child attributes to Lookup are static string values.  Lookup itself uses StringBuilder to compose a reference based upon its children.

                2016-09-22 09_56_38-__RDAVIN7250_Analytics Examples - PI System Explorer.png

                 

                The source attribute referenced by ".\Child1|Static Attribute" is:

                2016-09-22 09_56_57-__RDAVIN7250_Analytics Examples - PI System Explorer.png

                 

                Note that is not a PI Point.  Now the analysis could look like:

                2016-09-22 09_57_33-__RDAVIN7250_Analytics Examples - PI System Explorer.png

                 

                Here's the funny thing.  I like to break my expressions up into smaller steps so that I can see what happens for each step.  That doesn't work here.  You must put TagVal(TagNum(PointerName)) together.

                2016-09-22 10_04_46-__RDAVIN7250_Analytics Examples - PI System Explorer.png

                 

                Another thing I tried was TagVal(TagName(PointerName)) but it failed too.  The only thing that worked is as shown, which is why I suspect its an undocumented feature.

                2 of 2 people found this helpful