How to work with decimals discreetly?

,

Hello friends, is there a way to allow users to type in decimal values with many decimal digits, but only show a fixed amount of decimals in other places of the app without compromising the calculation precision?

Excel for example always calculates with ALL decimals that you give it, but it allows you to tweak how many decimals you want to see at any given time.

In my use case there are times i might need 5 decimals for example, but if i set all my numeric columns to allow for 5 decimals it really phucks up the column width of those columns, and when displaying those values in workflows there is what i call “numeric column type algebra”, that, well, means that whenever i use those columns in operations, the result is going to have the same amount of decimal digits. And that means i have to choose where to drop the decimals in order to display a result in a more aesthetic way.

Bonus: Explained with parrots

If parrots were decimal digits, i want users to type in:

quad parrot party parrot

But only display:

3 Likes

I would create an additional field to hold the re-formatted valued.

This is something I do quite often actually. Some might say it goes against good data schema practices (duplicating data), but it’s not really duplicating data:

  • one is for data entry
  • one is for display.
5 Likes

I do the same quite often.

3 Likes

@Rafael_ANEIC-PY

Just to give you an “idea” regardless it fits to your needs or not while we dont have perfect and native solutions out of the box from Appsheet.

When we set the field to decimals (say 2 decimals), they are hard coded and no control after that. The user can not put decimal number 1.020122 where more than 2 decimals. This is what it is.
To remove this restriction, we need to change the field type, suitably just text/strings. Then user can add any number, decimals arbitrarily.

However, we need to validate the entered date is either number or decimals.

I m not doing full check-up, probably I may missed some validation rules, but

and(
isnotblank(extractnumbers([_this])),
sum(extractnumbers([_this]))=decimal([_this]),
decimal([_this])<>0
)

Pushing expression to valid if constrain, we are able to make sure the data entered into this field is just decimals, or numbers. The entry such as

  1. 020 (space inbetween)
    a12.0115 (no numeric value)

etc could be ruled out.

Once we capture the proper number/decimals with arbitrary number of decimals as you want, then you manupulate this data by convering to decimals type using other virtual column.

Just as an idea as your starting point.

5 Likes

Hey guys ! @MultiTech_Visions @tsuji_koichi thank you for your advice, i’ll think more about it and return to you with the results, i was hoping there was an easier way to deal with it, hmm, maybe I should post it as a feature request then?

If i do, do i have your vo… never mind hehe

2 Likes

You mean like this?

3 Likes

Yes ! that’s exactly what i had in mind too, i didn’t find it because i was looking for “decimals”, but as a solution it fits perfectly.

2 Likes

Hello friends, it’s me ya boy again. fast parrot party parrot
I opted for a combination of @MultiTech_Visions and @tsuji_koichi san solutions while we wait for our feature request getting worked on @Marc_Dillon hehe.

For inside the app, i’ll do this:

For the workflows @tsuji_koichi san’s post made me realize i don’t need appsheet to handle the decimals for me, i can just round it however i want and turn it into text ! and also append the currency symbol to the left.

You guys turned a massive headache of mine into so many new ideas, thank you !

3 Likes