Keeping duplicate objects in a list

Hi! So I am extremely new to Bubble (like 6 days new) and I’m trying to store values from a database as a list. However, the list won’t accept duplicate values. As you can see, I tried to test my app by buying 2 of each item. So the entry under Qty would have been (2,2,2). I’m sure the same problem will be there if the prices became the same. Is there a workaround? I am really stuck and need some help.

PS: I am trying to build a small-scale ecommerce app to help people in my locality during the covid crisis.

Welcome to Bubble.

Keeping list of “related stuff” in multiple lists is not the way forward.

Create a new data type called “item” (or whatever) and have the description/price/quantity on there.

Then have a field called “list of items” (or whatever) of type Item and tick the “this field is a list”.

If you haven’t done so already, the tutorials will show you how lists work.

I would …

Create a table called Items with a field Name and a field Quantity and a field Price - it would also be helpful if you added a field called Transaction so you can cross-reference from one table to the other - makes life easier.

In your Transactions data table add a new field called OrderDetails, make it of type Items not text, and check the List checkbox.

When a user orders, Create a New Item with the fields Name & Price & Quantity filled in for each item they order. Then in your Transactions table add that instance of Item to your list in the OrderDetails field. Finally, add the Transaction instance to the Transaction field in the Items table.

Which is effectively what @NigelG just beat me to saying :slight_smile:

1 Like

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