Very basics operations in datafield

Hey, everybody!
Newbie to Bubble, I’m stuck on a calculation method and its expression to perform basic mathematical operations on databases.

I’m confuse between using “calculate formula”, “mathjs” or doing my operations in the workflow.
I just need to add and visualize the values entered in a data field “food distribution”, but how and where do I write the right expression?

Thanks to you

Here is what I’ve tried with mathjs…

hi, so there is the plugin: math.js (local), which is an element you move into the editor (you are using it) and also mathjs (using a get api call)

for the local one:
for example as the expression you can have input As value* input Bs value. (make sure the inputs have content type integer/number)
then you can have a text element showing math.js A`s result.

You can also have a group, which has content type number and use it in the calculation or take parts of your repeating groups content. E.g. let us say you have a repeating group of files, which each have a nr. of likes. then you could take the first items number for instance and multiply it by something.

2020-04-28 22_08_54-Backends _ Bubble Editor 2020-04-28 22_08_12-Backends _ Bubble Editor 2020-04-28 22_08_03-Backends _ Bubble Editor

for the get API one. select “Get data from an external API” inside a text element, when it says “insert dynamic data” to configure this

Let me know, what exactly do you want to calculate?


For short tips on Bubble & more check

1 Like

Thank you very much @TipLister for your precision and your help

What’s make you choose a solution rather than another? (local/api)

well in bubble editor under plugins for “math js local” it says the following. So normally unless lots and lots of calculations I would use not the local one.

1 Like

Hello @tiplister, did you ever have the problem, that saving your result to an data point was not possible or just saved a 0? I am struggling with this.
in step by step I can see that the calculation was done correct. but still nothing is saved to my database… cheers

Hello @TipLister,

As per you suggestion, I tried using math.js( local) plugin for simple Matahematical Calculation.

Only thing is that I have one User-defined Input Number ( Decimal ) and multiplied by Variable Number ( Integer).

This Variable number is fetched from Database when user selects options from the Dependent Dropdown menu.

After I do this, multiplication is not seen in the Preview Page.

So My questions are -

  1. Can one use math js ( local) for multiplying Variable Input ( Number-Integer) by User-defined Input Number ( Decimal )
  2. In math.js (Local) is it that Integer must be multiplied by Integer Number & Decimal by Decimal Number

Can you please suggest what must be gone wrong?

I have attached screenshots of my query.

So then, I also tried using Expression whose Screenshot is attached here

Your Help is much Needed Here.