# Order of operations

Still no parenthesis? Can’t calculate a simple VAT sum

1 Like

So my work around to missing PEMDAS is to calculate what would be in parenthesis in separate disabled input fields:

Here and example of Value A + Value B + Value C, where Value C is (Value B * 0.07). I tried using text fields but they wouldn’t have it. I haven’t finished building my shopping cart yet, but I’m assuming it would be beneficial to have input fields anyway, so I can create a new order item.

1 Like

Anybody interested you can use the Formulize plugin to achieve this and alot more. Basically excel formula in bubble with custom variables

2 Likes

Is it done in 2019 ? cant find

Nope, not possible yet. You could probably use a plugin for it, but it’s not built in to Bubble natively.

Bubble team? Is the plan still to add this functionality at some point or is this not even close to a priority?

4 Likes

Bubble team, please add paranthesis. They are really necessary for a variaty of backend conditional statements!

4 Likes

I haven’t used this yet, but does the api for math.js give you this functionality? I could be wrong though. But yes native would be best.

Yeah, and even doing it in 2 steps with a custom state is painful as an expression like “1-{data}” cant be entered …

Calculating a margin or a VAT takes way longer and way too many hacks than it should.

1 Like

Try {data} x -1 + 1

Because there are no order of operations, you can do these types of workarounds in a single step.

I had divisions after that, but my workaround was {data}*0+1-{data}

Bump.

1 Like

Newbie here…
I haven’t been able to figure out workaround described in this chain. Can someone explain slowly for a newbie?
I have created a 1st app that helps figure out cost to produce and price a new consumer good. Struggling with some simple math:

1. User enters price
2. App calculates Cost of Goods Sold (COGS) based on users other inputs (sum of labor, materials, etc)
3. App accurately calculates GM (Price - COGS) and presents as GM\$
4. Can’t get it to calculate GM% which is GM\$/Price, or: (price-cogs)/Price…can’t figure out how to put parenthesis in equation or otherwise mimic parenthesis via some type of workflow.
Here’s a screen print:

appreciate the help, al

“no-coding with JS” - Bubble
Great!

Jesus, this feature is crucial! Just develop it ASAP ,please!

5 Likes

It works left to right, not order of operations. I’ve realized that while creating my app. A way to work around it is to run a workflow for the part you want calculated first, store that value, and then create another workflow segment for the second part, etc.

Also very surprised parentheses not possible - seems very basic - just adding my +1 for this feature to be added

3 Likes

You have brackets in the Expression builder (Toolbox plugin) if you really need them. Which you usually don’t.

5 Likes

Great thanks @NigelG for the reply

Expression plugin works great! A little weird that I have to create an element in the builder for each impression. It’s still better to have a native parentheses feature.

1 Like