Filter out duplicted

Hey Bubble friends

I am looking for a way to filter duplicates.

I have a database of products sold.

This means that lets say there’s a list of:
Hat
Hat
Hat
Hammer
Hammer
Phone
Knife

I want to do a filtered search that will filter out the duplicates so I want the result of:
Hat
Hammer
Phone
Knife

Its probably really simple just cannot find it!

Hey,
Try using the :unique elements expression at the end of your search (or filter). That should do the trick in filtering out the dups e.g. text outputs

Best

wont work as each object has a SKU and I want a list of all names and SKU. If I use that it loses association…

Presumably you only care about displaying the text values (otherwise it doesn’t make a lot of sense)…

So, of course it will work… just use :unique elements on the text values.

I want to preserve the associated sku

I can’t test it right now, but I think you can get the associated SKU if you use the :group by operator and group by the product name. Have you tried that already?

I want to preserve the associated sku

But which one?

If there are 3 hats, but you only want to display 1, then which SKU are you talking about (how will you decide that?)

I assume the hats are the same product, and they all have the same SKU. Hmm, this might be a data type setup issue.

1 Like

as @mikeloc says, if they all point to the same SKU then you can Group them by SKU (or Name for that matter)…

But, why are there multiple items with the same name and same SKU in the first place?

I don’t think there are multiple items. I believe Tom is talking about a Product Sold data type, so each thing in that data type should be linking to a unique thing in a Product data type, and that could be the issue here.

Tom, if you just want a list of products and their associated SKUs, don’t you have that list somewhere else? You shouldn’t have to go through a products sold data type to get it.

1 Like

Right, yeah… if this is a list of ‘products sold’ (which it is… I missed that on first read), you should simply be able to get each item’s Product (to get a list of Products), then use :unique elements (assuming Bubble doesn’t automatically de-dupe that list anyway).

Or use Grouped by Product (depending exactly on the Use case)

That assumes that the ‘Product Sold’ datatype links directly to a Product (which it definitely should).

1 Like

Or instead of using unique elements or group by on the Product Sold data type, just show a list of products and their associated SKUs from the Product data type.

1 Like

spent a good 4/5 hours trying and sadly, the best I could do was:

remove duplicates but then its just a useless list of text
Keep duplicates and it has the associated SKU

Bubble lists can’t contain twice the same data.

Well, like I said, the issue is likely that you don’t have your products stored in a way where you can easily get a list of them and their SKUs, and if you want to share screenshots of your data types, we might be able to help. Given that you didn’t react at all to any of that discussion, though, I’m guessing it’s not relevant to you for one reason or another, so I’m not sure what else we can do here.

Yes, they can…

and actually having since tested it, in the case I described, Bubble does NOT de-dupe the list, so you would have to use unique elements to remove the duplicate items.

Why couldn’t you do any of the things suggested in this thread (it should be very simple, by the way… if your database is set up correctly)

My remark only applies to the front-end states containing Bubble’s primitives as a list.

Backend lists have a different structure and aren’t deduped.

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