Comparing lists of Things only on specific fields

Hello

I’m trying to use the Advanced filter to check for duplicates in a table field containing a list of Things but to only filter/ compare two of the Thing’s fields.

I’m getting no results back when I expect to get the duplicates.

Specifically, I’m looking for rows in my products table that contain duplicate lists in the attribute_ids field (which is a list of attribute Things).

The list of duplicate products should then be displayed in a repeating group.

Because I only want to compare certain fields of the attribute Things in the list field, I’m performing a ‘format as text’ operation on the attributes to try to compare only the two fields I want included.

My data is structured as follows:
Table: product
name: text
attribute_ids: List of attribute Things

Table: attribute
name: text
value: text
product_id: product Thing

My repeating group search for the duplicate products looks like:

With both the ‘format as text’ functions above set up as:

Format as text

Is this approach correct for returning the duplicate products and have I implemented it correctly? Or is there a much better way to go about this?

Look forward to your help!

This is a mockup of my setup:

Would really appreciate some help on this. Perhaps my decision to use the Advanced filter was the wrong tool? If there’s any way to compare/filter lists of things on specific (not all) fields it’d be great to know about it.

Thanks

I’m just reading your post trying to wrap my head around this. So you want to find duplicates but not duplicates of the actual thing, but duplicates if the thing’sname AND value are the same? or is it name OR value?

Hi, yes it sounds like you’ve got it. I’m looking for the same name AND value. So look for products whose attribute list contains things with all the same name and value. It’s for an inventory tool that should allow only one product with a particular combination of attributes and no duplicates.

Do you mind enabled edit access on that link you sent? I started to explain maybe something that would work but I think I need to try it myself :joy:

1 Like
  1. Your list of Things will NEVER contain duplicates of some specific Thing.

1.5. Unless you construct some list of Things yourself using one of my plugins that allow you to construct such lists, in which case you will know whether there are duplicate Things or not.

  1. A list of Thing’s fields MAY contain duplicates. (Example: let us say our Things are Products and Products have a Price field and there are multiple unique Products in our list that have the same Price. In this case, the duplicate Prices will appear if we reference that list of Products each item’s Price. Further example, let us say that our app represents a dollar store and all Products have the same Price, 1.00. In this case, Search for Products :items until 10 and Search for Products :items until 10: each item’s Price will both yield lists of the same length (10 items). But in the former case, all Products will be unique and in the latter case, every number in the list will be 1.00.

  2. But let’s consider that list of numbers: If you now try to do some Bubble list operator on it, the list will collapse into a list with only one item in it (1.00), because Bubble lists are not arrays, but Sets. It’s probably this that is causing you problems.

2 Likes

Thanks, I’ve enabled the rights! I should mention though that I think I will be taking an approach now that saves a different list of things on the product such that these lists can be compared for identical things across all fields, rather than only looking on the specific fields of name and value. So please don’t feel the need to try anything more for my specific problem, but feel free to use the test app if you want to try your idea anyway, and I’d of course be interested to see if you do!
Thanks for you help looking into this.

1 Like

Thanks for you message. It’s useful to know that the lists are sets rather than arrays. I think based on your reply I will take a new approach that allows me to compare lists of things that will either be fully identical things or not.

Thanks again for your help!

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