Skip to main content
Question

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

  • June 27, 2015
  • 0 replies
  • 39 views

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.


This topic has been closed for replies.

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.

  • Author
  • Quickbase Alumni
  • June 27, 2015
oh that's just so good.  Thanks Mark!

  • Quickbase Alumni
  • June 29, 2015
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/

Thx Dan, I'm good with being Yin to your Yang.

  • Quickbase Alumni
  • May 30, 2019
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.