7 Replies Latest reply on May 29, 2015 7:25 AM by Kirk_1

    Evaluate

    Kirk_1

      Title

      Evaluate

      Post

      I don't understand why this does not evaluate to1.

      I have a tool that i can evaluate individual items in a calculation.

      Both memory variables evaluate to what the data viewer does...with in the calculation, but if i evaluate $OriginService = "D" that is 0. The same for $DestinationService.

      Capture.PNG

        • 1. Re: Evaluate
          philmodjunk

          Your syntax is incorrect. Use:

          If [ $OriginService = "D" and $DestinationService = "D" ]

          • 2. Re: Evaluate
            Kirk_1

            Thank you

            • 3. Re: Evaluate
              Kirk_1

              I get the same thing. I double checked each one for accuracy with in the calculation. Combined they are 0 and $OriginService = "D" evaluates to 0.

              • 4. Re: Evaluate
                philmodjunk

                Then it would appear that the values are not just "D", maybe the letter D followed by a space, return or other non printing character.

                Try using the length function to see if they are really one character in length.

                • 5. Re: Evaluate
                  Kirk_1

                  You are right, there is a space in front. Which brings me back to my problem yesterday.

                  In parsing this, i have numbers and characters. There is a space in front that comes from the API.

                  It comes like this:

                  "Total"

                   113.66,

                  or

                  "CarrierName"

                   Carrier Name Here

                   

                  I've tried these ways to remove the space... The Char does not eliminate it, the 2nd removes the 1st line and the 3rd  remove the space but it removes the space in the name as well. Trim removes the spaces in the name as well.

                  //Substitute ( TempEdi::TempEdi ; [Char ( 8221 ) ; "" ]) 

                  Substitute ( TempEdi::TempEdi ; GetValue (  Left ( TempEdi::TempEdi; 2 ) ; 2 ) ; "" )

                  //Substitute (TempEdi::TempEdi;" ";"")

                  Any ideas?

                  • 6. Re: Evaluate
                    philmodjunk

                    If [ Trim( $OriginService ) = "D" and Trim ( $DestinationService ) = "D" ]

                    You can also use Trim with the set variable step to remove the space from the variable.

                    But this assumes that it's actually a space and not a tab or other nonvisible character.

                    Filter is a function you might consider, though listing all the characters, both upper and lower case that you want to pass through the filter can be a bit tedious.

                    Substitute ( text ; " " ; "" )

                    will remove all space characters from text, so that might be another option.

                    You may also find the code function useful as a way to identify the actual character if it turns out that it's not really a space.

                    • 7. Re: Evaluate
                      Kirk_1

                      Ill trim the individual ones i need, good advice. Thank you.