3 Replies Latest reply on Mar 11, 2010 12:22 PM by comment_1

    "If" Script Step

    jeffd

      Title

      "If" Script Step

      Post

      Need help to solve a simple "If" script step using several seveal logical operators.

      The script step I am using is;

      If [Customer Quoter::Equipment Status = "New" and (Customer Quoter::Equipment Make ≠ "John Deere" or Customer Quoter::Equipment Make ≠ "Hitachi")]

       

      This step doesn't work properly, i.e. all records are coming back "false". It does work if I remove "or Customer Quoter::Equipment Make ≠ "Hitachi".

       

      How should I be writing this step in order for it to work properly?

       

      Thanks

      Jeff

        • 1. Re: "If" Script Step
          ekm12

          I think if you add a few more parenthesis you will be all set.  See below, hope this helps...

           

          If [(Customer Quoter::Equipment Status = "New") and ((Customer Quoter::Equipment Make ≠ "John Deere") or (Customer Quoter::Equipment Make ≠ "Hitachi"))]
          • 2. Re: "If" Script Step
            ninja

            Howdy Jeff_D,

             

            you can nest the ifs in your script if it is more intuitive:

             

            If (Customer Quoter::Equipment Status = "New")

                 If (Customer Quoter::Equipment Make ≠ "John Deere" OR Customer Quoter::Equipment Make ≠ "Hitachi")

                      Do this

                 EndIf

            EndIf

             

            I find this method easier to visualize...but opinions vary.

            • 3. Re: "If" Script Step
              comment_1

              Jeff_D wrote:

              all records are coming back "false".


              Are you sure about that? Because this part:

               

              Customer Quoter::Equipment Make ≠ "John Deere" or Customer Quoter::Equipment Make ≠ "Hitachi"

               

              will ALWAYS be true. You didn't say what do you actually want, but it seems like you need to use:

               

              Customer Quoter::Equipment Status = "New"
              and
              Customer Quoter::Equipment Make ≠ "John Deere"
              and
              Customer Quoter::Equipment Make ≠ "Hitachi"