I´m having issues with the calculations that sometimes Bubble makes, they are not complicated but sometimes doing “field_1 * field_2” returns too many decimals and as it does not round when saving it, then when exporting the data with 2 decimals we have problems.
For example we do field_1 * field_2 and this returns 2,64684 then when exporting the data we say to export with just two decimals and we´re finding that it does not make the rounding.
The formatting as returns two decimals, the problem is that if it´s saved with a lot of decimals then sometimes A + B = C that you can see when saving it returns that C saved is not equal to C rounded.
Maybe you can try to use the :rounded to function?
here’s a documentation reference:
:rounded to Rounds the first number so that it has X digits after the decimal: 0.234 -> 0.23 if the argument is 2. Note that for 0.5 rounded to a number without decimal will be 1
There’s a hack you can use to manage this, which is not the simplest one (or prettiest one), but does the job.
The sequence would be something as follows:
You do your math
Get the result, and format it as you need (2 signs after a decimal), after what it becomes a text
You save that text in the db
Next time you pull the value for the calculation, you first get it trough the above mentioned hack (Input converting any data type to any data typ) to convert it back to number and do the calculation, then repeat the steps 2-3.