2 Replies Latest reply on Jun 15, 2010 7:08 AM by LisaB.

    Rounding numbers to show cents



      Rounding numbers to show cents


      I am using filemaker pro 8.5. I am new at script writing. I am trying to find out the unit cost of a brochure. I'm dividing the cost by the quantity. The figure it gives me always is a round number. It will not show anything less than 1.00. I can't figure out how to make it say for example, 1.26 so that the cents will show up. I have tried rounding it in various ways but nothing seems to work. I looked in the knowledge base with no luck.


      My script starts out

      Div ( E. Print Cost ; E. Print Quantity )



        • 1. Re: Rounding numbers to show cents

          Div is a function that returns an integer value. It's the computer equivalent of doing grade school long division, finding the quotient and ignoring the remainder.


          Use this expression instead:   Print Cost / Print Quantity


          To round to the nearest cent, you can either enclose it in a round function Round ( Print Cost / Print Quantity ; 2 )


          Or format the field on your layout on your layout as a decimal with two decimal places.


          These two options are not equivalent, they just look the same. Which approach is best depends on how you need to use this value after you've computed it.

          • 2. Re: Rounding numbers to show cents

            That did the trick. Thank you!