1 Reply Latest reply on May 8, 2018 3:08 PM by gchermont

    Choosing bewteen two attribute values (both string) within AF (or strictly PI System Explorer)

    Chris_Hawkins

      This is related to at least one other post - per chance by a colleague - but sufficiently different (I think) to keep separate.

      I have two attrributes defined as floows in the parent element template via String Builder.

           Tag Name 1 = "%..\Element%";'Client Tag Delimiter';"%Element%";'Client Tag Delimiter';"%..|Attribute%";

           Tag Name 2 = "%Element%";".";"%..|Attribute%";

      Depending upon the value of a third attribute, Flag, I wish to copy one or other of the above to a forth attribute (that is then used as a PI Point name).

      In essence:

           if Flag = 1 Then

                Default Tag Name = Tag Name 1

           else if Flag = 2 then

                Default Tag Name = Tag Name 2

           end if

      Yes, I could create an AF Table in which each individual tag is defined for all elements in which it appears. But in my case the tag names are based upon the element structure defined via String Builder. There is no need to define each tag individually.

      Incidentally I already use a Table Lookup to see whether the customer has defined their own tag for this attribute via a look-up table. If they have It use that, otherwise I use Default Tag Name. What I'm now attempting to do is for Default Tag Name to be one of several string values.

      Other approaches?:

      • AF Analytics - but this is a one-time configuration - so would intrduce unncessary overheads.
      • Change the value in the element template - no that's what I'm trying to avoid as this would mean we would have different templates for different customers.
      • Confifure via PI Builder or some other client application.

      Any ideas? Am I simply being too ambitious?

        • Re: Choosing bewteen two attribute values (both string) within AF (or strictly PI System Explorer)
          gchermont

          Hello Chris,

           

          You could use PI Analysis with an expression like if 'Flag' then 'Name1' else 'Name2' and set it to run once a day. That would not demmand much from Analysis.

           

          Unfortunately that cannot be implemented on Formula data Reference since it does not support string attributes.

           

          However you could also separate your string builder attributes into subattributes like the example below if the tags always have the format you mentioned (that would demmand more effort to configure).

           

           

          Only one Default Name attribute needs to be created with the following configuration.

           

          • If Flag is 1 the Delimiter attributes would both be set as "Client Tag Delimiter" and Field1 would be set to "%Element%".
          • If flag is 2 Delimiter1 would be set to "", delimiter2 would be set to "." and Field1 would be set to "".

           

          So that the expression '.|Field1';'.|Delimiter1';"%Element%";'.|Delimiter2';'Attribute1'; would render the correct tag name.

           

          Hope this helps.