Get values out of textfield or Math.JS

I must say I am really not getting math beyond the most simple possible. For example, with the expression limitations… how do you do a sum-product?

To get around bubble’s inability to have parentheses when it forces left-right evaluation, I tried to print out the products so I could sum them later. But I can’t grab the values out of the text fields.

The red indicates the products that I want to sum up (they are not products of the two numbers on the left). So the correct values are right there. So now I would like to have an expression and simply sum the values in each field. I could do that if Bubble would allow me access to those values, but it doesn’t.

Alternatively I can recreate the products and sum them up. But the left to right execution makes it impossible to get the right answer.

So I tried to download a plug in, I tried Math.js and toolbox. But I cant seem to enter in the parentheses I was promised would work in there.

Some info…
A Divisystem a bubble data type. the metals are fields in the type. Each of those fields are loaded in by an API.

and the issue with math.js is that I simply don’t see how to put the parentheses in. I can type the first one, but the closing parens doesnt work. I’m probably being stupid.

Maybe try the Env variable plugin. Have a look at the demo page for an example

That looks useful, and solves part of the clunkiness of bubble (not constants or variables except states). However, my app its a free info tool. Paying for a plug in for a free tool is not economically sound for me.

Isn’t there a sumproduct list operator? I’m pretty sure there is… may be labeled as something else, but it’s there…

(If you have a list of numbers, you can append that operator, just as you would with :sum)

I think sums and sum products work with lists. I have separate data fields.

If you have a list of numbers, you can append that operator, just as you would with :sum

Can you explain this process to a 5 year old please?

Ok. Let’s assume this is a repeating group displaying different fields of a list of things:


The “Total Divi in Tier” column might be the thing’s TotalDivi field.

That repeating group’s “List of things’s TotalDivi” is a list of numbers.

The sum of that list would be:

ThatRepearingGroup’s List of things’s TotalDivi:sum

^^^ this goes in an expression field. The value returned will be a single value of data type number.

Of course such a list could also be sourced from a search (the same search that feeds to RG in the first place).

You might also construct a list of values based on user input or whatnot.

Any list of numbers (an array of numbers) will have the various numeric list operators available like :sum, :average, :max, :min, etc. (Consult the Reference for all the details.)

Similarly: Any list of texts will have a different set of list operators, appropriate for texts. Etc.

And I think we went wrong immediately. :slight_smile:

Its just values. in different data fields. But now at least I know I can do this when I do have a repeating group

This is the same question as you asked here:

Well, your data structure is the thing that’s “wrong” (vis-a-vis Bubble’s built-in operators), right? Knowing this info now, you’re better armed to design your data types in a way to easily enable these computations.

Yup. so I should have created a list of masternodes and I guess created a repeating group of information about it. This style or method or storing data simply doesnt work with my brain. Its gonna take a while. The issue is that I don’t trust I can access the items as I need Them. This was evidenced as I tried to search for the latest created in a list of Divisystems and spend days trying to figure out how to get the latest one.

It is???

In that question I am trying to get the plug in to return correct data by modifying there results it gets from an API call.

Here I just want to figure out how to get around the left to right math evaluation or use values I have already created.