Sum of Unique Items from the DB

Hi,

I am trying to find out a solution to list the sum of unique Items from a table.

My actual need is, If I store the below data in the bubble database,

I would need to update/create a new table with a logic linking from above data as listed below

Can you please help me with this?

Thanks in advance

As far as I know, Bubble doesn’t really do this. You’d probably have to keep a separate field for “Pens” that gets updated anytime one of your customer gets their pen quantity updated. I’d love to be wrong here!

Updating the rows with the sum would be possible via a bulk workflow.

Creating them in a workflow might be more difficult. Bubble doesn’t much like “mass” inserts.

Is this a one off populate of a table ? Or something you want to do every time ?

It is a dynamic update I would be using every time throughout various process and different modules. Hence I would need this logic to work to build my application.

We don’t really support this yet. Once thing you could do is hardcode the different lines in the second table on a page, and then do a search for all things of type A whose product in ‘pen’ and then do “'s quantity” and take the sum of that list.

1 Like

Surely you can make a change to a list. Where the list is the list of all products.

And then sum up all the “order” quantities and update the total.

If you make sure your “order” thing has the product in it as a type it makes it a bit easier.

4 Likes

Thank you Very Much @NigelG …

It works :slight_smile: