Count unique things in a Data Type (count DISTINCT records in a table)

Let’s say I have a Product data type with the field Category and the field Color and I want to count unique things for the field Color after constraining to a specific Category. How do I get to this?

Do a search for Product with a constraint Category = [category dropdown]'s value then close out of the search and do :each item's Color:unique items:count

I’m not getting the :unique option?

My bad it’s called :unique elements

Screenshot_5

1 Like

Ok that works.

Yea even I thought it was :unique items because I assumed they were different search result items or something (even that might not make sense, maybe they it should be :unique results or something). Elements doesn’t really make sense because that would be something you place onto your page…

Either way as long as you know that’s what :unique elements is you can achieve the result you’re looking for…

Although now that I think about it the word result is already taken because when one workflow action refers to the output of another it’s called the “Result of step x”

1 Like

Well, if we wanted to get pedantic-ish about it, @tylerboodman, arrays are typically said to have “elements” or sometimes “entries”. (Arrays are, well, arrays.)

In Bubble, however, the special case of arrays that Bubble supports is called a list… and lists are typically said to have “items”.

So there is a bit of a terminology mismatch here and I could swear that in the long long ago that that operator was :unique items. :man_shrugging:

Anyway, doesn’t really matter, that operator (regardless of what we call it) makes the list a Set, resulting in a list/array without any duplicates entries/items/elements.

2 Likes