Forum Documentation Showcase Pricing Learn more

Fill list, detect a duplicate and put it as same item to the list sorted by quantity

Hi Pros,

I am quite new to Bubble and have a Question:

I want so set up a Shopping list where all item bought will be stored in a list. That is already working. Now when e.g. I have already “Ice” on the stored list and next time I am putting again “Ice” onto my Shopping list I don’t want to have a second entry (so 2 times “Ice”) in the list. I want to have it just once and have in column 2 the quantity how often the product was bought and sorted the list by that.

Don’t
Product Quantity
Ice 1
Ice 1

I want to have it that way
Product Quantity
Ice 2

How is that possible to check whether the product was bought already and if so just increase the quantity by 1?

Many thx for your support.

br
Daniel

HI there, @ddiers1… I don’t know exactly how you have things set up, but you are likely going to need to use the :group by option, and here is an example.

Let’s say I have a data type called Purchased Items, and the data in it looks like this…

I could set up and configure a repeating group like this…

… and the result on the page would be this…

purchased3

Is that what you’re shooting for? If so, hope my example helps.

Best…
Mike

1 Like

Thats great Mike, it works, many thx.

But another Question: How can I sort the list by the sum of quantity?

Happy to help, @ddiers1. To sort by the sum of the quantity, just add the :sorted option to the end of the repeating group’s search…

Best…
Mike

Works perfect, you are the best. A really very last Question: How can I delete an entry in a repeating Group by clicking an Icon?

Well, it’s a grouping, so can we assume that when the icon is clicked, you want to delete all of the items associated with that grouping? If so, you will add an icon to the repeating group and associate a workflow with the icon that deletes a list of things. In my example, the list to delete is a search for purchased items where the name equals the current cell’s grouping’s name.

Best…
Mike

Wow, great, many thx and have a nice evening, Mike

1 Like