3 Replies Latest reply on Jan 19, 2015 3:55 PM by philmodjunk

    What is the best way to script this?

    Kirk_1

      Title

      What is the best way to script this?

      Post

      This is an if script step.

      IDinbound = d  IDoutbound = d  Transitdays = ""

      I need to test 2 things to continue:

            if inbound or outbound days have a D, both must have a d.

            if transitdays is populated, if empty stop

      this evaluates to a 1; is it taking the 1st true statement and stopping the evaluation then?

       

      Quote_InBound Terminal Days::TTZ_IDInbound = "D" and Quote_OutBound Terminal Days::TTZ_IDOutbound = "D" or Quote_InBound Terminal Days::TTZ_IDInbound = "D" and Quote_OutBound Terminal Days::TTZ_IDOutbound = "D" and not IsEmpty ( Transit Days::TTD_TransitDays )

      What is a better way to script this? a case needs a test and reslut...

        • 1. Re: What is the best way to script this?
          philmodjunk

          What we have here is not a script. It's a calculation.

          When you string together a series of Boolean expressions separated by And or Or operators with no parenthesis to group them, they evaluate from left to right starting with the first Boolean expression: IDinbound = D.

          Your expression doesn't make a whole lot of sense:

          Note that the first two Boolean expressions (red) are exactly the same as the next two (blue). They will evaluate exactly the same way and so they appear redundant:

          Quote_InBound Terminal Days::TTZ_IDInbound = "D" and Quote_OutBound Terminal Days::TTZ_IDOutbound = "D" or Quote_InBound Terminal Days::TTZ_IDInbound = "D" and Quote_OutBound Terminal Days::TTZ_IDOutbound = "D"

          Best guess is that the desired Boolean expression should be written as:

          ( Quote_InBound Terminal Days::TTZ_IDInbound = "D" and Quote_OutBound Terminal Days::TTZ_IDOutbound = "D" and
             not IsEmpty ( Transit Days::TTD_TransitDays ) )

          Or

          ( Quote_InBound Terminal Days::TTZ_IDInbound ≠ "D" and Quote_OutBound Terminal Days::TTZ_IDOutbound ≠ "D" and
             not IsEmpty ( Transit Days::TTD_TransitDays ) )

          But I am not at all sure that I am correctly understanding how you want this logical expression to evaluate.

           

          • 2. Re: What is the best way to script this?
            Kirk_1

            The parenthesis made the difference and you are correct the it was redundant.

            (Quote_InBound Terminal Days::TTZ_IDInbound = "D" and Quote_OutBound Terminal Days::TTZ_IDOutbound = "D" and not IsEmpty ( Transit Days::TTD_TransitDays ))

            Evaluates correctly.

             

            Thank you

            • 3. Re: What is the best way to script this?
              philmodjunk

              Then you shouldn't need the parenthesis now that there is no OR operator in your expression.