Forum Academy Marketplace Showcase Pricing Features

Trouble grouping an option list output by an attribute field

I have two sets of options lists. The attributes are set by linking to the category list.

Category: Ocean, Land
Item: House (Land), Condo (Land), Boat (Ocean), Surfboard (Ocean).

I want to display:
Ocean
Row: Boat, Surfboard
Land
Row: House, Condo

Having trouble structuring the right way to output this on the page. Hoping to get some feedback on the approach here. Thanks!

Hello @spaclinks !

Have you tried using :filtered on your option sets to filter in the first time all the options where category = Ocean then category = Land ?

This would involve having an attribute on your Item list linking to the category option set.

Using filter is not the best option regarding to performance, but in your case if you have only a few items it will not harm user experience.

Let me know if you need more help.

1 Like

There isn’t really a way to group option sets so the way you’d need to do it is to have a repeating group for your Category option set (select All Category). Within each cell of that RG have another RG which is for your Items option set. In the Data Source set it to All Items and add a :filtered to it which is set to “This Item’s Category is Current Cell’s Category”. I’ve knocked this together quickly in the project below which will help explain it

If you were dealing with actual data you wouldn’t do it this way (you’d use :grouped by instead) but as it’s option sets which are static lists and not data and you’re never going to dealing with huge sums of data then it’s not an issue.

1 Like

I was able to get the desired results with this structure.
There is 2 total types and 9 total items, so this is a small list.

Thank you for the notes on performance.

Wow! I am reviewing this in detail now. I generalized the function names & had to reprogram it to bring it into my site. Having multiple way to approach using options feels very powerful. Thank you for doing this.

1 Like