Long calculations in Bubble

I am setting up a simple calculator in my app. Users will enter their inputs in the fields under “Trip Details.” The app then calculates the subtotals for “Driver Pay,” “Fuel Cost,” “Trip Reserve,” and “Markup.”

Using the formula editor I run into two issues that I cannot seem to find a solution to:

  1. The “Breakeven” subtotal does not seem to follow Bubble’s left to right schema for calculations and I keep returning too high of a value.

image

  1. Ideally I could calculate a grand total, but until I can figure out issue #1, I do not know how to get this ultimate answer.

Thank you, and I appreciate any help the community can provide. I am more than happy to provide clarifications or additional data/screenshots if needed.

If you go to App settings → Versions tab → at the bottom is you can enable the Parenthesis feature, that will save you a lot of headache on what exactly their order of operations is doing

is there a way to force where the parentheses are added if the editor inserts them incorrectly?

Yes once you enable it you might need to rebuild the expression a little bit, but the way you do it is as you build from left to right you click More… in the spot you want inside or outside the parenthesis

With parentheses, the expression evaluates to three separate calcs…clearly I am not getting something that should be straighforward!

image

I’m confused what I’m looking at :joy: It looks like 3 separate calculations you are doing with the () and + manually typed out.

What I mean is the blue expression you screenshotted earlier, it will let you click More in certain spots to force the values either inside or outside parenthesis. You don’t type ( ) or +, it puts ( ) automatically and you would pick + from the operator options. I’m not gonna say this is intuitive how they have us doing it but it does make sense after a while… :rofl:

Finally got it. Definitely not intuitive at first, but makes sense once you see the pattern and learn exactly where to click. Thanks for the help!

1 Like