Order of operations

Thanks, the custom state did the trick, a bit of a hassle but a good work around.

I put this question in the OOO thread because if OOO was implemented with () available then I would enter: ListPrice * (1 - Discount). I have to do 1-Discount * List Price. The other alternatives in this thread were more complex than necessary given I can rearrange the order for this simple equation. This may help others getting started and coming across this issue and like me they might be searching for order of operations help.

1 Like

Any suggestions on how to calculate rating averages. [(1:count x 1) + (2:count x 2) + (3:count x 3) + )(4:count x 4) + (5:count x5 ) ] / (1:count + 2:count + 3:count + 4:count + 5:count)

The 1,2,3,4,5 are star ratings. How many times a rating shows up times it’s rating number divided by the total number of ratings given to get the average rating for that user. Or maybe I’ve forgotten math.

Update: the toolbox is the answer. using expression on the page from elements

@jess is there an eta on this feature? All i need is A*(1-B) right now. Should be very simple.

2 Likes

UPVOTE THE SUGGESTION ON IDEABOARD! It’s called “Order of operations & more advanced arithmetic capabilities” and somehow it only has 12 votes despite people asking for this for 5 years.

2 Likes

Unfortunately, we’re not able to share a timeline for this, but we’re certainly keeping the request in mind and will let you know if any progress has been made.

@Eks_ST its worse than just order of operations. Doing 1 - variable is not possible. You have to make a variable (state) and put 1 in it and then you can do 1 - variable via … state - variable.

I like bubble for its ease but it seems like they have taken their foot of the gas and are just coasting and not fixing foundational problems. Its honestly a very bad sign @jess and @emmanuel . Success is a terrible motivator. Its not just this problem. Its that paging is not really finished. Its that you have a clunkly relationship between password strength-o-meter and policy settings. And more.

When I first started with bubble a few weeks ago I was blown away but as i’ve encountered these years old problems inside common scenarios I gotta wonder if you guys are the right bet for us long term.

Its like when you meet someone that you really get along with only to find out that they dont wash their hands after going to the bathroom. Makes you think.

Wash your hands bubble.

5 Likes

Please, Please make this a thing! Bubble could make great calculator apps if this was possible. Forget full PEMDAS. I’d settle for just respecting parenthesis.

@Eks_ST is correct. “Order of operations & more advanced arithmetic capabilities” needs more upvotes on the ideaboard.

1 Like

First time I’ve checked the Ideaboard in a while… uhhh… no wonder it’s a graveyard. :confused: And I can see why this particular idea has only 12 upvotes… I can’t even find it and I imagine most people haven’t even seen it.

There’s still no searching/filtering on the list (unless you go to try adding a new idea in…) and there are a TON of ideas - Most of which you can tell are not going to go anywhere since they’re not particularly good ideas…

As someone mentioned in another forum post, the Ideaboard needs significant work. :frowning:

Edit: I found it and added my upvote. For anyone confused, you have to “submit an idea” to be able to search… sigh

2 Likes

Please, add parentheses () for math operations :pray::pray::pray:

1 Like

So for anyone (@PineappleJoe) who has this problem where they need to do something like this:

Price * (1 - Discount)
where rearranging it as
1 - Discount * Price
doesn’t work because you can’t enter “1” first in the argument,
this is how you do it:
Discount * -1 + 1 * Price

I’ve used this many times.
Obviously, it would be better if Bubble would fix this order of operations problem @jess , but in the meantime, this is better than using custom states or intermediate hidden inputs.

3 Likes

@josh Can you guys pleaaassssseeee add in order of operations, or at bare minimum parentheses? I am so tired of having to run javascript every time I need to do some calculations. I understand you guys are a no code platform but this is not code, this is math. There are simple calculations that just are not possible with right to left formula evaluations such as xy + pq

2 Likes

Hello @josh

I´ve been testing putting the “trigger the custom event” at the end of the workflow so it waits for the others to finish but it actually does not work either.

The only way it works is by adding the pause.

How can we solve this?

I just posted about a question exactly like this. Some good suggestions in the thread.

7 years later…still no parentheses! So frustrating

2 Likes

This plugin will get the job done for me: Math.js

You can simulate parenthesis by using arbitrary text: converted to number

For instance
Current things number - arbitrary text(5*6):converted to number

I use this sometimes even when I have order of operation but the calculation is long so if I have to modify any part I don’t have to start from where I’m making the change

4 Likes

Yes but that plugin only works for client side workflows. It won’t work for backend workflows unfortunately

Wow I’ll have to try this out! You can build long expressions this way?

No, no you can’t.

If I may inject, I have used arbitrary text this way and it does work.

A cumbersome but functional solution.

1 Like