5 Replies Latest reply on Aug 27, 2012 5:11 PM by philmodjunk

    How do i invert a number?

    Kirk_1

      Title

      How do i invert a number?

      Post

      The $discount_pct is the number we offer as a discount. 17.5 or 21.30... how do invert it so i don't have an additional step of subtracting the discounted amount by the rate?

      If i did not have the getvalue it would be ($discount_pct-100)*-1... ive tried that a couple ways and cant get the syntax to work. That would turn 17.5 into 82.5...

       

      GetValue ( $discount_pct  ; $counter ) * $toplinenumber

        • 1. Re: How do i invert a number?
          philmodjunk

          100 - $discount_pct

          would tke 17.5 and produce 82.5

          • 2. Re: How do i invert a number?
            Kirk_1

            GetValue ( $discount_pct  ; $counter ) * $toplinenumber

            It messes with the counter that way. Only does it once and there are 4 portal fields im filling in on this specific application.

            If i remove the 100- $discount_pct it fills the others in.

             

            Also how do i get it to round up?

            • 3. Re: How do i invert a number?
              davidanders

              http://www.filemaker.com/help/html/func_ref3.33.19.html

              Home > Reference > Functions reference > Number functions

              Number functions
              Number functions are used to manipulate numeric data.
              Click a function name for details.
               
               
              This function
              Returns
              Abs
              The absolute value (a positive number) of a number.
              Ceiling
              A number rounded up to the next integer.
              Combination
              The number of ways to uniquely choose a specified number of items from a set of specified size.
              Div
              An integer of the specified number divided by the divisor.
              Exp
              The value of the constant e (the base of the natural logarithm, equal to 2.7182818) raised to the power of a specified number.
              Factorial
              The factorial of a specified number stopping at 1, or at a specified number factorial.
              Floor
              A number rounded down to the next lower integer.
              Int
              The whole number (integer) part of the value you specify, without rounding.
              Lg
              The base 2 logarithm of the specified number, which can be any positive value.
              Ln
              The base-e (natural) logarithm of the specified number.
              Log
              The common logarithm (base 10) of the specified number, which can be any positive value.
              Mod
              The remainder after a specified number is divided by divisor.
              Random
              A random number between zero and one.
              Round
              A number rounded off to the specified precision (number of decimal places).
              SetPrecision
              Any math functions contained within the specified expression to the specified digits of precision, if the math function supports extended precision.
              Sign
              One of three possible values: -1 when the specified number is negative, 0 when it's zero, and 1 when it's positive.
              Sqrt
              The square root of a number.
              Truncate
              A number truncated to the specified precision (number of decimal places), without evaluating the value of the discarded digits.

               

               

               
              Symbol
              Name
              Definition
              +
              Plus
              Adds two values
              -
              Minus
              Subtracts the second value from the first
              *
              Multiply
              Multiplies each value
              /
              Divide
              Divides the first value by the second
              ^
              Power Of
              Raises the first value to the power of the second value
              ( )
              Precedence
              FileMaker Pro evaluates formulas from left to right, performing multiplication and division before addition and subtraction. Using parentheses lets you change the order: FileMaker Pro evaluates expressions between parentheses first.
              • 4. Re: How do i invert a number?
                philmodjunk

                try it this way:

                ( 100 - GetValue ( $discount_pct  ; $counter ) ) * $toplinenumber

                • 5. Re: How do i invert a number?
                  philmodjunk

                  Though to really use it as percentage, it should be:

                  ( 100 - GetValue ( $discount_pct  ; $counter ) ) * $toplinenumber / 100