Not able to solve maths equation issue

Hi, I have a data type Stock under which fields are Current Price & Quantity…
A particular portfolio will have multiple stocks each having its own current price and quantities…

What I intend to do is get the value of the total portfolio such as :
Stock A Current Price * Stock A’s Quantity
Stock B Current Price * Stock B’s Quantity
and so on…
The total sum of the individual sums of each stock…

Note: Current Price is coming from an API which takes one symbol as a required parameter…

Hence when I put the value in Get data from an external API as “Search for each items portfolio: each item’s stock’s symbols” the value I get in return is StockA, StockB…(Which is a list hence the API cannot return a proper input as it needs a particular stock not list)

Same with the quantities, when I use “Each item’s Stock’s Quantity:Sum” it by defaults returns a value which is the sum of total of all quantities.

But instead what I want is for them to be a separate line by itself like I mentioned above Stock A’s Price x Qty, Stock B’s Price x Qty and the sum of the totals of these! Please help! Attaching a few screenshots


Screenshot 2023-06-21 at 1.34.36 PM
Screenshot 2023-06-21 at 1.34.48 PM
Screenshot 2023-06-21 at 1.34.51 PM

Greetings, when working with calculations in the Bubble platform, we don’t follow the typical hierarchical order of mathematical operations. Instead, Bubble performs operations in a left-to-right sequence, without giving priority to any particular operation.

Bubble does offer the use of parentheses as an experimental feature. If you enable this feature, it could potentially enhance your comprehension of the calculations being performed.

Update: I think I found the thing which I was looking for, which is “SumProduct” …
So now I can multiply A’s price with A’s quantity, B’s Price with B’s quantity and get a sum of the same! The only problem that persists now is the price comes from API , the call of which requires only one parameter so I can only call for price of A or B, not both at once, can anyone help how can I update the same together in the “Calculate sum product” tab

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