2 Replies Latest reply on Apr 18, 2018 7:38 AM by Jcan

    Issues in PI Expression

    Jcan

      Hello all,

      I've an expression for multi state in PIprocessbook,

      My expression is comparing the average of TAG1 between the first day of the year and now with TAG2

      so, i try there lines but nothing is good.

      • if TagAvg('TAG1', Concat('01-Jan',Year('*')), '*')> 'TAG2' then 1 else 0
      • if TagAvg('TAG1',  Concat("01/01/","2018")), '*')>  'TAG2' then 1 else 0

       

      I have a some error popup "Point or expression evaluation error"

       

       

      But it's running best if i wrote:

      • if TagAvg('TAG1', '01-Jan-2018', '*')> 'TAG2' then 1 else 0          (but it's not a good idea to write as like it.)
      • Concat("01/01/","2018") ====>>> 01/01/2018
      • Concat('01-Jan',Year('*'))====>>> 1/Jan-18

       

      Some one have an idea?

      I need your help please.

        • Re: Issues in PI Expression
          afink

          I believe the problem here is that the result of Concat() returns a string, where the second argument of TagAvg() is expecting a time.  You should be able to use '1-Jan' to get the beginning of the current year for the TagAvg() calculation (see below).  So, the expression would look like the following:

           

          IF TagAvg('TAG1', '01-Jan', '*') > 'TAG2' THEN 1 ELSE 0

           

          - Adam

          3 of 3 people found this helpful