New Plugin: Easily Calculate Math Expressions

Hi everyone!

I’ve noticed how math calculations can be a little challenging in Bubble - even if it is a simple ordered calculation that makes use of brackets. This plugin is for those who’d like a simple way to implement math that can’t be evaluated directly in Bubble.

Plugin Page: Complex Math Expression Calculator Plugin | Bubble
Editor: Blur-apps-playground | Bubble Editor

HOW TO USE IT:

  1. In the Editor, find the ‘Math Calculator’ element in your Visual Elements and add it to your Bubble App

  2. In the properties of this element, assign the input Expression by building a text in the form of a mathematical expression.
    This expression can include operators like +, -, /, *, ( ) brackets and more.
    It will also accept boolean expression operators like ||, &&, ^, ! and more.
    The expression can also include data from dynamic sources. For example, 1+(Do a Search for Users:count *3) is a valid expression and will take the value of the Bubble dynamic data and calculate with it.

  3. Now you can make use of the results of this calculation in an element for displaying or calculations.
    For example, WHEN MathCalculator A's Number Result > 3 is a valid expression for any element’s conditional properties.
    And 3*MathCalculator A's Number Result is a valid expression for displaying visual elements like Text, Buttons, etc.


Some good use cases are checkout pages, repeating groups displaying complex dynamic values, etc.

Hope this helps!

3 Likes

This plugin is nice, but I can’t use it for backend workflows. I wish someone would build a plugin for server-side math expressions that doesn’t rely on an external API.

1 Like

Try formulize - I think it’s a paid one though

Alternatively if you go to settings on your app, you can opt in for one of the new experimental features that lets you do some of this on your dynamic text editor!

1 Like

Trying to get this formula to work (works in Excel):

=ROUND(((C22-40)/20((C9^0.425)*(C10^0.725)71.84/10000)0.739/C9-0.003)^0.50.7,4)

The cell references have been replaced by the unput fields.
Do I have the syntax right? (not getting the correct answer).
What does it do?
It is a body fat calculator that takes 10 body fat site measurements, adds them all up (C22) and then performs this calculation.
The Bubble workflow take all the values, sums the 10 values and then performs this calculation.
Any help much appreciated.

I should have mentioned:

  1. The result I am getting is the “number” -1 (minus one)
  2. The formula as it stands above produces a percentage result in the Excel sheet.
  3. I’m not sure how to handle the fact that without a percentage field the formula would produce a fraction result e.g. - 0.1648. I’ve tried multiplying by 100 in the calculator and then also in the workflow.

Hello,

I have a lot of calculs to do and each one is dependent of the precedent result.

Is it better to do one WF Action with:

Step 1 Calcul 1
Step 2 Xstep1 result
Step 3 YX
step2 result

Or

Calcul 1
Then use the action When math calculator Step 1 is done calculating
Calcul 2
Then use the action When math calculator Step 2 is done calculating
Calcul 3

I am wondering if the second version is safer or unnecessary ?

That’s an error response.
It understands pure BODMAS syntax, like you’d use in Javascript, not Excel formulae.

Option 2 would be more reliable.
You want to avoid cases where the the next step starts before the previous one finishes - this may happen on async operations on Bubble - especially when the next step can’t reference the previous step’s result.

The plugin is good for frontend operations, but not suitable for backend workflows. You can try formulize or an experimental feature in bubble settings for server-side math expressions. For the body fat calculator issue, the formula syntax might not be correct. Use option 2 as it ensures each step finishes before the next one starts. Overall, the plugin is useful for scenarios like checkout pages and displaying dynamic values.

1 Like