6 Replies Latest reply on Mar 13, 2017 1:29 PM by Chris_Hawkins

    Dynamic reference in Analysis Templates

    Chris_Hawkins

      I've already read recently that what I'm attempting to do may not be possible. I can't recall where!

      What I would like to do is create a generic expression in an Analysis template that includes references to several element|attributes. While the element|attributes are fixed for an installation they will vary between systems. And what I'm trying to avoid is having to manually edit the expressions (there are many!) for each system.

       

      I've tried various things:

      • Using CONCAT() within Analysis to build up the AF Path from sub-strings for the element / attribute names
      • Creating an attribute of type string using stringbuilder that contains the (full) path for the element|attribute I wish to reference in Analysis.

      Neither of the above work as  the Analysis variable remains as s string, i.e. it isn't cast into a AF Path.

      Any ideas?

      Regards

      Chris

        • Re: Dynamic reference in Analysis Templates
          Asle Frantzen

          Hi Chris

           

          How advanced will your expressions be? Have you considered the Rollup functionality within Analyses? They are able to work on child elements (and child element references) directly below the element containing the analyses, meaning you don't have to reference each element individually.

            • Re: Dynamic reference in Analysis Templates
              Chris_Hawkins

              Asle

               

              Thanks for your reply. I’ve not considered Rollups simply because what I want to do applies to the current snapshot in time. But …

               

              My expressions are not in themselves that complex. Simply some if then else conditions based on comparing attribute values in different elements and then copying a series of values from one element to another.

               

              Here are some screen grabs that hopefully indicate what I’m doing. Hopefully gives you something upon which to make a suggestion.

               

               

               

              In the above variables such as TS1 and TS2 are essentially ‘hard-coded’. Okay while I have 2 test separators but not if I have 1 or 3 or 7 or … In part I require a For Each construct (which I believe is ‘in the pipeline’ but this alone would not I think solve my issue.

               

               

              The hard-coding ripples through to the next two expressions as if I have a different number of test separators I need to manually edit the expressions. Not in itself a major task. I guess I could create them in Notepad but nonetheless cannot but feel that this is a retrograde step. I could do this and more using PI-ACE but have migrated away from this as I am aware that it is a deprecated product.

               

               

               

              Regards

              Chris

              Chris Hawkins | Senior Consultant | Process Systems & Solutions

              Emerson Automation Solutions | 2 Eggleston Court, Startforth Road , Riverside Park | TS2 1RU | Middlesbrough | United Kingdom

              T +4401642773061 | M +4407764929518

              Chris.Hawkins@emerson.com<mailto:Chris.Hawkins@emerson.com> | http://www.emerson.com<http://www.emerson.com/>

               

              Knowledge is Power. Use the Emerson experience<http://bit.ly/1TNiptg> to ignite your performance.

                • Re: Dynamic reference in Analysis Templates
                  Asle Frantzen

                  I see, so you're basically trying to determine which separator is in use, or which well is being tested atm?

                   

                  It's true there's no for each construct right now, so you'll have to work around it. I always try to move as much logic as possible onto the elements themselves, thus making it easier to do the overall calculations.

                   

                  ACE is still a valid product until we're able to add our own custom functions into the expression function library, but I too try to avoid it. Valid solutions for custom code would be a custom data reference in AF, or an AFSDK application going into your AF database and doing the custom calculations on a regular basis.

              • Re: Dynamic reference in Analysis Templates
                Chris_Hawkins

                I restructured my approach and avoided using all but a single line expression in PI Analysis. The rest of the required functionaility is now handeled within my element/attribute templates.