Math calculation

Hello guys!

I’m struggling with Bubble to calculate easy math formulas and I cannot find the answer by myself.

I need just to calculate: Input A value / (Input B value - Input A value)

I’ve tried Javascript to bubble, Math Js and other calculation plugins but the result of all these plugins is always empty.

Can someone please help me with a step-by-step orientation to calculate this?

Thanks a lot

Hi there, @luiz.o.rodrigues… if both of your inputs have a content format of integer and you have enabled either the experimental parentheses feature or the new expression composer (I am showing the latter below), then you should be able to build an expression that looks like this.

calc

Hope this helps.

Best…
Mike

Thanks, man. Both are integers. How can I enable this feature here?

You can enable either of those features on the Settings >> Versions tab. I recommend using the new expression composer so you can start to get used to it.

Hello Mike. I’ve already updated to this version we talked, but as I see here I need an expression that has priorities during the calculation. The expression within parenthesis must be calculated first. In the solution above the first division operation is calculated and after the subtraction, and so I got the wrong answer.

Is there a way to get this priorization of operations here?

@grace.hong the TLC’s (as @mikeloc calls them) don’t do a good enough job at making their function clear - this question would never be asked if they were parentheses instead :slight_smile:

1 Like

If you get the TLCs to look like what I have in my screenshot, it works as expected.

Yup, George knows. I should trademark TLCs in relation to Bubble’s made-up parentheses. :wink:

Hey @luiz.o.rodrigues

This probably happened due to formatting of numbers from localization or using thousands separator. More details at Expression docs

I’d expect similar issues if using the workaround of Arbitrary Text :converted to number to override order.

Still it is better to use Bubble’s dynamic data where possible.

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