Calculation errors

Hello,

I´ve a page where I put the following calculations based on the price 1, tax 1 and tax 2. So you type the price, tax 1 and tax 2.

Then I´ve fields below that calculates the tax 1 cuota which is “price * tax 1” and tax 2 cuota which is “price * tax 2”, then the total which is “price + tax 1 cuota - tax 2 cuota” and I´m getting weird results.

For example: price = 1, tax 1 = 10 and tax 2 = 10. The app calculates the total = 19 € and it should be just 1 €

Here´s an screenshot.

Preview: https://mynewtestapp.bubbleapps.io/version-test/demo?debug_mode=true

Editor: https://bubble.io/page?type=page&name=demo&id=mynewtestapp&tab=tabs-1

Thanks a lot guys.

Nope it´s not resolved.

I don´t what is doing but it´s not calculating well.

You probably need to turn 10% into .1 by dividing by 100. As Bubble isn’t like excel I don’t think.

Thanks @NigelG,

I´m still figuring out what´s the issue. I think there might be something wrong.

Bests.

On your tax calculation, remove the number formatting. The decimal and comma separators might be messing things up.

also, as Nigel said above, Tax enter as 20% needs to be divided by 100.

You would be better to have custom states to hold all the raw numbers and do the calculations on, then present these in the UI using the number formatting options.

Give that a go and see what happens then.

Thanks but the when inserting 20% in the input field and making the calculation, it´s interpreted in other app that we have as 0,2.

this is what I see;

Yeah that´s another problem that we´ve with percentage. We´re only getting this issue in that app so I don´t really know what to do.

Thanks a lot.

Why don’t you simply use Number for all values, and then only present the user with formatting.

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.