Forum Discussion

MichaelGraham2's avatar
MichaelGraham2
Qrew Assistant Captain
10 years ago

How do I force a user to ONLY enter up to 2 decimal places?

We have products with unit costs with 4 decimal places but want our sales reps to quote unit price to only 2 decimal places.  Sometimes they forget and use more decimal places and this throws the quote out as it only shows in 2 decimal places which are rounded up.


  • Try this

    Make a formula-text field called [Warning on too many decimals] like this

    IF(Abs([price]-Round([price],0.01))>=0.001,"Too many decimals").  Put that field on the form near the price field and hide the label.


    Then make a form rule that says

    When the record is saved

    and [warning on too many decimals is not equal to (blank)

    abort the save with message "Too many decimals.  Correct the decimals to two places and tab out of the field  and then try saving again"


    (note that like Excel, QuickBase does not see the input or the corrected input until the user tabs out of the field.  That can be confusing to users as they may fix the price, and then keep trying unsuccessfully to Save. Try it and you will see what I mean.
  • HTML5 Form With Input With Pattern - Add New Record
    https://haversineconsulting.quickbase.com/db/bj25hj6wv?a=nwr

    Pastie Databsase
    https://haversineconsulting.quickbase.com/db/bgcwm2m4g?a=dr&rid=398

    Mnookin: "On Average We Have Two Answers To Every Question"
    https://www.youtube.com/watch?v=9uR_t-6iTJk&feature=youtu.be&t=3m50s

    How dichotomous! Native v Script, Yin v Yang, Geometric v Algebraic

    @Mark - My analogy so I ascribed you Yin and I claimed Yang

     http://www.differencebetween.net/miscellaneous/difference-between-yin-and-yang/
  • I'm trying to implement similar logic, but limiting the user to 5 decimal places, rather than just 2. There seems to be some limitation with QB formulas/functions, based on the length (that is, 5 vs 2), that I can't quite wrap my head around. Is anyone able to implement this logic successfully?
  • Did this not work for you?

    IF(Abs([price]-Round([price],0.01))>=0.001,"Too many decimals").  Put that field on the form near the price field and hide the label.

    In your case it would be

    IF(Abs([price]-Round([price],0.00001))>=0.000001,"Too many decimals").  Put that field on the form near the price field and hide the label.
    • DanLadner1's avatar
      DanLadner1
      Qrew Trainee
      That does work--though I would have sworn I tried that, I must have bungled it up when trying to account for the additional decimal places. Thanks Mark!