Math operations

Is there any documentation about how to make math operations with Bubble?

I’m trying to make a sub, (10 - Current’s User Current Points)…

How to do it?

Any of the math plugins have documentation, there is no video on Youtube, and any mentions about MATH OPERATIONS on Bubble Manual or the Full Reference… :frowning:

My experience is that bubble is bad in mathematical operations. I have given up to let more complex calculations be calculated. Not sure, but I think bubble calculates from left to right. As a result, it does not know dot before dash and no parentheses. (Does not exist anyway)

Solutions were with me. To create a separate group of type number, to let calculate the single operations there and then to let calculate the results again in a new group. and so on…

2 Likes

I would really recommend the Toolbox plugin for this. You’ll find an element called Expressions, which gives a lot more freedom in math expressions than Bubble does out of the box.

2 Likes

You can do basic math on most Dynamic fields, though very basic ones (ie no parenthesis). Download the Toolbox plugin and add an Expression element to do more complex things.

1 Like

image

It doesn’t work… :frowning:

There is plugin called “instant calculator” built by copilot. I use it to calculate complex arithmetic.

I believe (10 - Current’s User Points) is not a complex arithmetic… :confused:

image

It doesn’t work…

I can’t believe so hard is to make a simple basic math operation on Bubble… :open_mouth:

Is possible to create ERP and CRM apps, but it’s impossible to create a calculator… :rofl:

1 Like

Assuming the Current’s User Current Points field is a number type and not text you should be able to easily calculate:

“Current’s User Current Points - 10”

You have to use the built in “-“ operator not type it out yourself. Anytime you use the “more” tool which is connected to a number and not a text value then you should see a list of all the basic math operators.

1 Like

Almost there!

I could calculate “Current’s User Current Points - 10”.

But, on my app, Current’s User Current Points is always less or equal 10, that’s why I need to calculate “10 - Current’s User Current Points”.

Any suggestion?

Regards!

1 Like

Set a state anywhere on the page and define the type to number and set the default value to 10 and use that in the expression.

State’s value:more select “-“ Current’s User Current Points

1 Like

You can’t combine text with a dynamic expression. All math needs to happen within the Dynamic expression.

I’ll have to agree this part is kind of weird :sweat_smile:

This should be working. Are you sure that you’ve set the Expressions’s Result type to number?

Are you seeing any debugger errors?

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