Forum Academy Marketplace Showcase Pricing Features

How to filter identical items in repeating group?

Hello,

lets say my type is workers and one field is hair color.
Now I have many workers with identical hair colors.
My problem is that I want to use a repeating group to create a navigation.
(Like “brown hair | blonde hair | red hair”)
If I search for the field hair color then my repeating group shows the color “brown” multiple times instead of just once.
I am a bit confused and frustrated by this. Has anybody an easy solution?

1 Like

There are a :unique items attribute you can use.

Search for hair_color: unique-items

Good luck

So I would do it like that:

Type of content: Worker
Data source: Search for Workers:unique items

Then I place a textbox into my repeating group with “Current cell’s Worrkers haircolor”.

I’ve tried it like that and I think I am missing something obvious…
Because that doesn’t really work for me
Have an idea?

Hi there, @florian.barthel94… the problem is you are searching for workers, so each item is a unique worker regardless of their hair color.

If you are trying to create a hair color repeating group for navigation purposes, the data source of the repeating group should be whatever it is you are using to define the hair colors (note that it can be done with a search for workers and unique items, but I’m not sure why you would go that route). Are you using an option set (which is likely how I would do it) or is it a custom data type? Whatever it is, if you set it to be the source of the repeating group, you can get a list of all of the different hair colors.

The above being said, I would probably go a different route if you are simply trying to filter a repeating group of workers based on things like hair color. You could have a repeating group like the one you described (i.e., a search for workers), and you could have a dropdown above it that lists the different hair colors. When you select a hair color from the dropdown, the repeating group could filter down to only those workers with that hair color. If you want to go this route, you would simply add a constraint to the repeating group’s search where hair color = hair color dropdown's value, and you would select the Ignore empty constraints checkbox to make sure all workers are shown when no hair color is selected in the dropdown.

Anyway, I hope what I have written makes sense, and I hope it helps.

Best…
Mike

1 Like

Hi @mikeloc ,

I just tried your recommendation and watched a tutorial on option sets. I think that is the best solution for my question even though I was eager to create it somehow with types.
Thank you for your help! :slight_smile:

1 Like

Correcting my answer:

Search for Workers: each item hair color: unique items

That’s how you’d make just with data types.

Option sets are a more elegant way to deal with data that can be listed, as hair colors.

unless you want users to be able to insert new colors, or to edit the existing ones -in that case, data types are the best choices.

2 Likes