3 Replies Latest reply on Aug 22, 2012 3:54 PM by philmodjunk

    Two conditions in a case

    Kirk_1

      Title

      Two conditions in a case

      Post

      I'm trying to put two conditions in a case again and its not working.

      Ive set the variables; $shipstatecalc = "~MW"  &  $constatecalc "~MW" to get the result... discounts::DcustperMW_MW

      I need to test for the from region and the to region, so I need to test for all of the scenarios below.

      Any suggestions?


      Case (
                      $shipstatecalc = "~W"  &  $constatecalc = "~W" ; Discounts::DCustPerW_W  ;
                      $shipstatecalc = "~W"  &  $constatecalc = "~MW" ; Discounts::DCustPerW_MW;
                      $shipstatecalc = "~W"  &  $constatecalc = "~E" ; Discounts::DCustPerW_E;

                      $shipstatecalc = "~MW"  &  $constatecalc = "~W" ; Discounts::DCustperMW_W  ;
                      $shipstatecalc = "~MW"  &  $constatecalc = "~MW" ; Discounts::DCustperMW_MW;
                      $shipstatecalc = "~MW"  &  $constatecalc = "~E" ; Discounts::DCustperMW_E;

                      $shipstatecalc = "~E"  & $constatecalc = "~W" ;Discounts::DCustPerE_W ;
                      $shipstatecalc = "~E"  & $constatecalc = "~MW" ;Discounts::DCustPerE_MW;
                      $shipstatecalc = "~E"  & $constatecalc = "~E" ; Discounts::DCustPerE_E;              
                     
      )

        • 1. Re: Two conditions in a case
          philmodjunk

          Use And instead of &

          & is the concatenation operator. It "glues together" text strings to make a combined string such as:

          LastNamefield & ", " & FirstNameField.

          • 2. Re: Two conditions in a case
            Kirk_1

            I get   0    as the result.

            I tried to remove the " " from around the "~MW" but it did not like that.

            I copied and pasted the varables so they should not be the issue...

            ------------------------------------------------------------------------------------------------------------------------

            Case ( not IsEmpty ( $discount_pct ) ; $discount_pct & "¶" ) and

            Case (
                            $shipstatecalc = "~W"  and   $constatecalc = "~W" ; Discounts::DCustPerW_W  ;
                            $shipstatecalc = "~W"  and  $constatecalc = "~MW" ; Discounts::DCustPerW_MW;
                            $shipstatecalc = "~W"   and   $constatecalc = "~E" ; Discounts::DCustPerW_E;

                            $shipstatecalc = "~MW"   and   $constatecalc = "~W" ; Discounts::DCustperMW_W  ;
                            $shipstatecalc = "~MW"  and   $constatecalc = "~MW" ; Discounts::DCustperMW_MW;
                            $shipstatecalc = "~MW"   and  $constatecalc = "~E" ; Discounts::DCustperMW_E;

                            $shipstatecalc = "~E"   and  $constatecalc = "~W" ;Discounts::DCustPerE_W ;
                            $shipstatecalc = "~E"   and  $constatecalc = "~MW" ;Discounts::DCustPerE_MW;
                            $shipstatecalc = "~E"   and $constatecalc = "~E" ; Discounts::DCustPerE_E;              
                           

            • 3. Re: Two conditions in a case
              philmodjunk

              make the change shown in red:

              Case ( not IsEmpty ( $discount_pct ) ; $discount_pct & "¶" ) &

              If I understand your syntax, you want concatenation there.