Quick Base Discussions

Expand all | Collapse all

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

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

    Posted 06-27-2015 18:51

    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.




  • 2.  RE: How do I force a user to ONLY enter up to 2 decimal places?

    Posted 06-27-2015 19:09
    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.


  • 3.  RE: How do I force a user to ONLY enter up to 2 decimal places?

    Posted 06-27-2015 19:55
    oh that's just so good.  Thanks Mark!


  • 4.  RE: How do I force a user to ONLY enter up to 2 decimal places?

    Top
    Contributor
    Posted 06-29-2015 14:43
    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/


  • 5.  RE: How do I force a user to ONLY enter up to 2 decimal places?

    Posted 06-29-2015 15:04
    Thx Dan, I'm good with being Yin to your Yang.


  • 6.  RE: How do I force a user to ONLY enter up to 2 decimal places?

     
    Posted 05-30-2019 12:29
    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?


  • 7.  RE: How do I force a user to ONLY enter up to 2 decimal places?

    Posted 05-30-2019 12:31
    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.


  • 8.  RE: How do I force a user to ONLY enter up to 2 decimal places?

     
    Posted 05-30-2019 12:37
    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!