3 Replies Latest reply on Sep 29, 2015 3:11 PM by jbrown

    Or Syntax

    rustyshackleford

      My following condition isn't testing like a thought it would:

       

      MASTER_Slip_Entries::k_PrebillApprovalStatus  ≠ "Approved"  or "Ready" or "Invoiced"

       

      When the field equals "Approved", the function doesn't calculate the way it should. Could anyone identify my error in this above syntax?

        • 1. Re: Or Syntax
          rustyshackleford

          The following syntax didn't seem to work either: "MASTER_Slip_Entries::k_PrebillApprovalStatus ≠ "Approved" or MASTER_Slip_Entries::k_PrebillApprovalStatus ≠ "Ready" or MASTER_Slip_Entries::k_PrebillApprovalStatus ≠ "Invoiced""

          • 2. Re: Or Syntax
            rustyshackleford

            I was getting the error cause of a logic break on my part. If status="ready", then (if status != "ready" or "approved") would still trigger when status="ready" because "ready" isn't "approved".

            • 3. Re: Or Syntax
              jbrown

              Those Or statements always get me, so I've started putting the conditions in a Let statement. Since ORs mean 'any one thing could be true' , I put that into a case statement. Something like this:

               

              Let ( [

              _Trigger = Case (

              MASTER_Slip_Entries::k_PrebillApprovalStatus  ≠ "Approved" ; 1;

              MASTER_Slip_Entries::k_PrebillApprovalStatus  ≠ "Ready" ; 1;

              MASTER_Slip_Entries::k_PrebillApprovalStatus  ≠ "Invoiced" ; 1; "") ] ;


              If (_Trigger = 1; <<do something>>>

              )

              )

              Case statements stop after the first true statement, so it goes through the list and the first one it finds, it sets the variable to 1 and then the IF statement does something.


              If this were in a script step, I'd set the $Trigger variable to the Case calc, then use that $Trigger in a IF script step.


              This is how I manage OR statements.