4 Replies Latest reply on Jun 26, 2018 12:23 AM by mlath2

    PI AF Analysis IF statement problem

    mlath2

      I have an attribute in AF that is a PI tag, that a user enters to populate a user trend screen.

      I am using an AF Analysis to return the tag name and description automatically,

      which is working when i have a good tagname.

      If the user enters an incorrect tag (ie spelling mistake), I want to put "Bad Tag" in the description,

      so i am using an analysis as follows, (good tag example)

      But if the tag is bad, the analysis fails. It looks like it is trying to validate the TagDesc before executing the IF

      (i.e tagname changed to \\swglgs6007\SINUSIO to make it fail)

      TagBad is working, if i put it on its own

      Any ideas how to get around this ?

        • Re: PI AF Analysis IF statement problem
          Dan Fishman

          You should be able to determine quality by looking at the attributes error message. 

           

            TagBad cannot be used to determine if the PI Point is entered correctly.  It could indicate that the value has a system digital state such as "calc failed".  If you really need this you could have an analysis that evalutes only TagDesc('Value0') and a second analysis that checks TagBad('description') with logic to output an appropriate message such as "tag not found".  Usually, end users are not entering tag names.

          2 of 2 people found this helpful
          • Re: PI AF Analysis IF statement problem
            Rick Davin

            Hi Andrew,

             

            Very nice pictures and explanation!

             

            The following can check to see if a PIPoint exists as long as that PIPoint is not a part of the trigger.

             

            Not BadVal(TagName('Value0'))

             

            If you run this expression first and store it to a variable named Exists, then your Variable1 and Variable2 could be changed appropriately to something like:

             

            If Exists Then TagDesc('Value0') Else "Point Not Found"

             

            If Exists Then TagName('Value0') Else "Point Not Found"

             

             

            1 of 1 people found this helpful