Edit more complex expressions

Any way to add parentheses?

See screenshot, I have a star rating icon that needs to calculate the average of some ratings, so I need to add them and divide by 4. If I can’t use parentheses, can I edit the expression by hand to add a /4 to each item? If I try to do now for the first item in the addition, it removes the rest of the expression.

Maybe I can do some trick by copy-pasting the parts of the expression from start to end to some other temporary controls to hold, but still it is tiring to do it like that

So I changed the expression to do:

but it seems to show wrong value. It is as if it calculates the expression in steps from left to right and gets a wrong value (not correct formula calculation mathematically that is, where / operator should have priority over + operator)

if it does indeed calculate the expression from left to right ignoring classic mathematical operator precedence please let me know so that I can rewrite the expression as it was before and just add a /4 at the end of it instead. Also let me know if this is by-design that won’t change (else it will break my expression in the future if you “fix” it)

oops, it seems to evaluate from left to right with no operator precedence. Not exactly something one would guess.

so this edit works - I was too lazy to reenter the expression (since I can’t edit it by hand and have to construct it again step-by-step manually, so I changed all divisions to /1 and kept the last to /4)

it would be best if I could merge all those 4 items and get the average of them. See my suggestion at :merged-with modifier for single items too, not for lists only for this one. Would allow to make lists on the fly from standalone values (could even have :merged-with modifier for literals so that you could quickly combine some in a list with other dynamic items and then get some calculated value from it like sum, average etc.)

Parentheses are on our list but it’s a pretty big change in our UI, so it’s unfortunately not for the immediate future.

1 Like

if one can make lists out of items on the fly, then maybe parentheses aren’t critical to have. However I don’t see an Empty List item to be able to build lists by merging that with more items as the expression goes on, neither a way to merge a single item with another one (or with a list passed to its right handside) to make a list

(not sure if this reply still applies, just visited this page again from another person’s link and the browser had kept a draft reply I though I had posted, but obviously hadn’t)

Good day,
@emmanuel and @birbilis

Just wondering if parentheses are available already? and if not is there a work around for this?

Thank you all!

No they’re not there yet.

can rewrite expressions to not have parentheses but it gets too complex. Best workaround is to calculate subexpressions in separate steps and store in database to use later.

Maybe it’s also possible to make a list of subexpressions in multiple steps of workflow and then refer to list indices. I think I had tried it but had problems achieving it, no way to make empty list and then lput or rput items in it if I remember well

I agree, parentheses would be very useful!

definately, parenthesis would be a lifesaver, to do some more complex operations you have to create tons of states to be able to reach the desired expression :frowning:

1 Like

I would also like parentheses. The integers form a ring after all!


It’s 5 years after it was first requested and I’m running into scenarios where very counter-intuitive expressions are required to get the answer I want - this seems like a really important improvement for Bubble to implement if it wants to be seen as intuitive.

1 Like

We just need this :grinning_face_with_smiling_eyes:

1 Like

Hi all - We recently released an experimental features UI that has a development version of parentheses. Learn more here! Hope you all have the opportunity to start playing around with it and help us iterate to make it better!