2 Replies Latest reply on Dec 14, 2009 11:37 AM by ninja

    Multiple "IF" in Script..



      Multiple "IF" in Script..


      This probably is very basic, but I can't find an example.  If you have something like this in a Script:


      If (something = something else)

      If (another something = another something else)

      Then perform something.

      End If


      What I am looking for, is if both IF conditions are true, then I want to perform something, but if either condition is not true, then it will not perform the next step. I don't see an "and" operator listed in the script list.

        • 1. Re: Multiple "IF" in Script..

          If [ Expression 1 AND Expression 2]

            #Do steps if true here

          End If


          Where Expression 1 might be Field > 5 and Expression 2 might be Field < 10. You'll find a number of logical operators, and, not, or etc listed in the Specify Calculation dialog that you use to enter the expression(s) between the square brackets.

          • 2. Re: Multiple "IF" in Script..

            You can also nest "If's" for multiple sub choices:


            If [sky="blue"]

               If [rain = "yes"]

                  Do this


               If [snow = "yes"]

                  Do that




            Though the multiple sub-ifs can typically be turned into a CASE statement instead.