5 Replies Latest reply on Jul 27, 2012 3:52 PM by Kirk_1

    Adding Fields

    Kirk_1

      Title

      Adding Fields

      Post

      I need to add three fields together.

      They may have leadilng 0. for example $ozipa = 00000 $dzipa = 00002

      Im adding it to 007072 = ratebasisnum

      Im using the script: Set varable [$adjustedreatebasisnum; value:GetAsNumber ( $ozipa ) + GetAsNumber ($ozipb) + GetAsNumber ($RateBasisNum )]

      The result i get is 7072.

      Why?

       

        • 1. Re: Adding Fields
          philmodjunk

          maybe because your 0002 is in a variable named $dzipa and your expression refers to a different variable named $ozipa?

          • 2. Re: Adding Fields
            Kirk_1

            No, unless im missing what you are saying...

            I have both... $ozipa and $dzipa... origin zip code and destination zip code.Im trying to add these three together...

            $ozipa = 00000

            $dzipa = 00002

            $RateBasisNum = 007072

            • 3. Re: Adding Fields
              philmodjunk

              I don't know if this is a typo in your original post or if it also exists in your database but in your original post you had:

              $ozipa = 00000

              $dzipa = 00002

              toratebasisnum = 007072

              Set varable [$adjustedreatebasisnum; value:GetAsNumber ( $ozipa ) + GetAsNumber ($ozipb) + GetAsNumber ($RateBasisNum )]

              $dzipa does not appear anywher in the set variable's calculation.

              In fact, it refers to a fourth variable: $ozipb for which you do not indicate what value it has.

              • 4. Re: Adding Fields
                Sorbsbuster

                As Phil says, you have mixed $Variables:

                "They may have leading 0. for example $ozipa = 00000 $dzipa = 00002

                "Im adding it to 007072 = ratebasisnum

                Im using the script: Set varable [$adjustedreatebasisnum; value:GetAsNumber ( $ozipa ) + GetAsNumber ($ozipb) + GetAsNumber ($RateBasisNum )] "

                That's 3 variables:

                $ozipa
                $dzipa
                $ozipb

                • 5. Re: Adding Fields
                  Kirk_1

                  Yep

                  Great point...I see it now

                  Thank you