Numbers: Display Digits vs. Internal Representation

Tap Forms – Organizer Database App for Mac, iPhone, and iPad Forums Using Tap Forms Numbers: Display Digits vs. Internal Representation

Viewing 2 reply threads
  • Author
    Posts
  • October 14, 2017 at 9:54 PM #25415

    Mike Schwartz
    Participant

    Brendan,

    Suppose I have a number entry field and set the number of decimal places to 2. My expectation would be that this controls how the number is displayed, but not how it is stored. So if I enter a value of 1.237 in my number field, I expect the field to display the number rounded up to two decimal places: 1.24. But internally, I want the true as-entered value to be stored, 1.237.

    However, that is not the case. Tap Forms rounds the number up to 1.24, and stores the value as 1.24. You can see this immediately if you add a calculation field and set its value equal to the number field, but set the number of decimal places to 6, for example. When I type the value 1.237 into the number field and hit RETURN, the number field displays 1.24 and the calculation field displays 1.240000. Or, if I redefine the number field to display 3 decimal places, it will redisplay the number as 1.240, not the 1.237 that I entered originally.

    Is this the intended behavior? It’s not good math.

    NOTE: Calculation fields don’t have this problem. If I create a number calculation field and give it the formula 10/3, then I can change the number of decimal places at will and have it display 3, 3.3, 3.33, 3.333 etc. But I think it’s still a problem for number entry fields.

    Thanks,
    Mike

    October 15, 2017 at 10:36 AM #25417

    Brendan
    Keymaster

    Hi Mike,

    I agree that it should probably work the way you suggest. However, it’s tricky because the database must store decimal values with a period for the decimal separator. But some regions use a comma. It varies by region. So I have a number formatter applied to the field which does that conversion. But it also applies the decimal places setting to the number too before it gets stored in the database.

    I’ll think about a solution to that problem though.

    October 15, 2017 at 10:37 AM #25418

    Brendan
    Keymaster

    Oh, also Calculation fields aren’t input fields, so they don’t have the number formatter applied to the input. Because they’re output only.

Viewing 2 reply threads

You must be logged in to reply to this topic.