Editing Decimal Place virtually without losing data

When I edit the field “Decimal places” setting, I want it to not affect the numbers itself but only affect the user interface so that it can be displayed in a nice way but the original numbers and decimal places are reserved
for example: I have a number of 10.53648, I want to display it as 10.5 to be user friendly but I still want to reserve the value of 10.53648 in the db in order to use it in the api or formula or other calculations just like how Airtable handles it

Hey @mahmouds12,

What about having 2 fields one for real value which is to 5 places and hidden then a user value which is a formula to use the value of real value but to 1 place?

image

This would give you something that looks like this…

image

It doesn’t fully solve the issue but it will work around it.

I like what @joffcom suggested, this makes sure that the value that is truncated is in read only mode and can’t be modified to “destroy” the decimals you are trying to preserve.

Out of curiosity, how does Airtable deal with that issue? If it was just an option on the field for example to say “only show up to x decimals but preserve the rest” how would you make sure that the decimals aren’t deleted once a user clicks on a cell to edit it?
Would you just show the truncated version when you are looking at it and once the cell is selected you show all the decimals?

Here’s how airtable handles it:
when u create a new field u have this option:
image
for example I added those two numbers
image
then edited the precision to 2 decimal places
image
and got this:
image
then edited again to 5 decimal places and got this
image
so, no data is lost in the process… it’s just a matter of display option and better user experience
If you change to 2 decimal places, and then write a number that has 5 decimal places… it will be saved with the 5 decimal places but only first 2 decimal places will be shown… then if you change the field to 5 decimal precision, it will display what you wrote with the 5 decimal places

Thank you
This is a workaround, but it will be better if it’s implemented in baserow without having to create an extra formula field, Also it will be read-only, but I want the sales team to be able to edit it without having to see all those decimal places.

@mahmouds12 what would happen if you edited the number in Airtable? Surely that would result in the places being lost or just set to 0?

In Airtable, lets say we have a number field with preciion of 2 decimal places, if a cell is selected it will show only 2 decimal places (according to the field settings) and if you don’t change the value, then it will remain the same (u did nothing here)
but if you select a cell and change the number to 5.3 for example, it will change to 5.3 and the old value with be lost and it will be displayed as 5.30

If you did the same, but changed the value to 5.3435, it will change to 5.34 and the remaining decimal places will be recorded in their db… so that if you change the field settings later to show 4 decimal places you will see 5.3435

@joffcom I think my last comment answers this too

1 Like

Right, this all makes sense.

So basically if a user wouldn’t know that you have changed the field to only show a certain amount of decimals, and they would go ahead and just edit that field, the data that was hidden will be lost and the user might never know why it was lost.

I can see how this is okay in some cases but if your goal is to not lose important data then this seems like it could be very error prone.

What do you guys think about a solution where you can configure the decimals that are shown but once you select the cell you can see all the decimal points. That way you can make sure you always edit the “real data” but you can still make your data more accessible if you are just looking at it.

1 Like

I like @Alex’s proposition. Thinking further into the future, setting a precision the way Airtable does might limit the number to a precision that we don’t want. As of this writing, Airtable limits the precision to 8 decimal points:

What if you have more? Scientists, researchers, and other professions might work with a precision that requires more decimal points.

Not having the precision field, and instead having all of the decimal points when you edit the cell, might make more sense.

Then again, what would happen if you paste in a number like pi? What would happen then? :thinking:

I think this would be the best approach