[SOLVED] Working with sub categories in repeating groups -- duplicate returns

I’m attempting to create a list of products grouped by sub category. My repeating group is displaying the subcategory multiple times (once for every item in that subcategory). Not sure how to structure the nested repeating groups so that they only appear once.

I have a Database Type of Products setup within that I have Category and Sub Category among others as fields. On this single page I’m trying to display the products of a given Category with the labels of Sub Category and the the Name, Description, etc. below each.

The top-level RG is the one giving the trouble with the duplicate Sub Categories. I have the data source set to search for the Category = “MyCategory”.

ting

One way to do it: create a data type for categories, list products and list subcategories under each category. Subcategory would either be text or a data type as well.

Categories

product list
subcategory list

Product

subcategory
name
description

Page type is category
RG is list of its subcategories

Within each cell is the subcategory name plus another RG of products (current page’s product list; constrained by products whose subcategory is the current cell’s subcategory)

the 2nd RG’s cells contain name, desc, etc.

3 Likes

Awesome thank you! That has worked. I didn’t realize I would need multiple data types to reference each other.

1 Like

Great! Yeah, sometimes you don’t need to, but often times it makes more sense, less redundant, less work, more efficient for your database structure and referencing, etc.

What can I do if I want to display data this way but only show selected products for each user, with the possibility that some categories are not used and therefore must not be displayed.

I know the thread is old but the topic is very fitting…