2 Replies Latest reply on May 9, 2017 10:04 AM by AnthonyDowns

    Short-circuit Operators

    AnthonyDowns Specialist

      Is there a way to use the operators (and, or) without short circuiting?

       

      I was wanting to apply a style on the list view but I'm having trouble getting it to evaluate the whole statement. This seemed logical to me, however, it does not work.  

       

      $(if Status != "Closed" or Status != "Resolved" and
      DateDiffSQL("day",  LastModDateTime,  CurrentDateTime()) >= 5
        then "ModifyDateFive"
        else if Status != "Closed" or Status != "Resolved" and
          DateDiffSQL("day",  LastModDateTime,  CurrentDateTime()) >= 2
             then "ModifyDateTwo"
             else "Default")
      
        • 1. Re: Short-circuit Operators
          AlasdairRobertson ITSMMVPGroup

          AND and OR are replaced with && and || respectively.  I just replaced you OR's with AND's and it works highlighted in Red Bold below

           

          $(if Status not in ("Closed", "Resolved") &&
          DateDiffSQL("day", LastModDateTime, CurrentDateTime()) >= 5
          then "ModifyDateFive"
          else if Status not in ("Closed", "Resolved") &&
          DateDiffSQL("day", LastModDateTime, CurrentDateTime()) >= 2
          then "ModifyDateTwo"
          else "Default")

           

          In 2016.x you can use Status in ('xxx','xxx') or Status not in ('xxx','xxx')

           

          Here is a link to the full list of operators:

          HEAT Operator List

          1 of 1 people found this helpful
          • 2. Re: Short-circuit Operators
            AnthonyDowns Specialist

            Thanks Alasdair. I didn't realize you could use IN with expressions, completely skipped over it in the help file.