# Groupings within a repeating group

**URL:** <https://forum.bubble.io/t/groupings-within-a-repeating-group/174426>\
**Category:** Database\
**Created:** [October 18, 2021, 11:33pm UTC](https://forum.bubble.io/t/groupings-within-a-repeating-group/174426 "2021-10-18T23:33:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![philsim](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/philsim/32/100834_2.png) [@philsim](https://forum.bubble.io/u/philsim)\
**Post date:** [October 18, 2021, 11:33pm UTC](https://forum.bubble.io/t/groupings-within-a-repeating-group/174426/1 "2021-10-18T23:33:26Z")

</div>

Is it possible to use groupings within a repeating group?

In the same way, within Airtable, Clickup, etc you can group items that share a similar field, I’m wondering how/if can do this within Bubble’s repeating groups? Or do I need to work this out using lists? I’m trying to break a list of tasks down into critical, high priority, etc and group tasks with those shared priorities together.

At the moment, I’m manually creating multiple repeating groups which means having five searches instead of one and is far from ideal!

---

<div class="post-metadata">

**Author:** ![lindsay\_knowcode](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/lindsay_knowcode/32/92967_2.png) [@lindsay\_knowcode](https://forum.bubble.io/u/lindsay_knowcode)\
**Post date:** [October 19, 2021, 12:08am UTC](https://forum.bubble.io/t/groupings-within-a-repeating-group/174426/2 "2021-10-19T00:08:46Z")

</div>

If the “parent” RG is a Thing with a list X on it, (ie 1 search) then there is no issue having an RG in a cell of the parent RG, populated with the list X.

Every performance guide I’ve read says that having searches within searches is _Bad_ - common sense really which you’ve already figured out 🙂

You could do an order by on “priority” (and/or add a numeric field as a proxy for priority so they display in a definable order) so they display in “bunches” of priority.

---

<div class="post-metadata">

**Author:** ![philsim](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/philsim/32/100834_2.png) [@philsim](https://forum.bubble.io/u/philsim)\
**Post date:** [October 19, 2021, 12:45am UTC](https://forum.bubble.io/t/groupings-within-a-repeating-group/174426/3 "2021-10-19T00:45:00Z")

</div>

So I guess this is the main issue that I’m struggle with - the parent isn’t really an RG as there is not a list of priorities. I’m still doing five searches insteam of one. It’s only really become an issue because I’m trying to use URL parameters now to do filtering, and searches are taking a lot longer. This is how I’m doing it now, with five RGs for each priority.

 ![image](https://us1.discourse-cdn.com/bubble/original/3X/7/1/71a2f214166862c20385cdf4a25324451a74225e.png)

I know I could do one search and order them, but I like the visual grouping so it is clear what is critical, and high priority.

Even putting an RG within another RG if I create a table for priorities, still results in doing five searches (well six now for the parent RG).

---

<div class="post-metadata">

**Author:** ![philsim](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/philsim/32/100834_2.png) [@philsim](https://forum.bubble.io/u/philsim)\
**Post date:** [October 19, 2021, 5:36am UTC](https://forum.bubble.io/t/groupings-within-a-repeating-group/174426/4 "2021-10-19T05:36:46Z")

</div>

So I’ve been reading the Bubble documentation, and I see that if Bubble sees the same search twice it does it once. So I imagine I will improve performance in the above by putting the same search on each item and then applying a filter to that same search?

Still can’t work out if this is possible to do dynamically

---

<div class="post-metadata">

**Author:** ![cmarchan](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/cmarchan/32/253062_2.png) [@cmarchan](https://forum.bubble.io/u/cmarchan)\
**Post date:** [October 19, 2021, 1:59pm UTC](https://forum.bubble.io/t/groupings-within-a-repeating-group/174426/5 "2021-10-19T13:59:37Z")

</div>

@philsim

Some ideas/comments for your consideration:

- Create a popup that you never open and call it “hidden popup for data”; add RGs and call them “data - things1”, “data - things2”, etc. As least RGs as possible of course in order to avoid unnecessary searches (… [RG vs "Search for" (performance questions) - #6 by cmarchan](http://forum.bubble.io/t/rg-vs-search-for-performance-questions/148543/6))
- Populate your page RGs with the hidden popup “data things”. The reason for this is multifold but in short … your searches will be ready to go on page load as popups are always loaded on the page no matter what and you have the ability to add conditions to limit the number of items loaded.
- Always remember that whatever you place on an RG is going to multiply by the nr of loaded items. Example: If you have a dB model where a project has a list of milestones and you have an RG searching for projects … then every project you load is going to load all of its milestones. Each one with their multiple milestones.
- Structure your dB avoiding list fields as much as possible and rather relate things indirectly (example: project and milestone; milestone is related to the project only and the project does not have a list of milestones). If you make your objects “light” your searches will be fast.
- Depending on how you structure your data you can do things pretty performing. Example: Project with no list of milestones and no list of tasks, Milestone with a reference to its project and no list of tasks, Task with a reference to its milestone and to its project.

For further reference to why I laid out the above please refer to this resource (paid) created by a very experienced Bubbler @petter which is full of gold nuggets, and to this other great post by @lottemint.md also full of excellent suggestions and an active and experienced contributor to this forum as well:

> [@The Ultimate Guide to Bubble Performance - 156 pages of optimizing tips](http://forum.bubble.io/t/the-ultimate-guide-to-bubble-performance-156-pages-of-optimizing-tips/125918):
>
> Hey everyone, I’m very happy to announce that I’m releasing my book [The Ultimate Guide to Bubble Performance](https://gumroad.com/l/the-ultimate-guide-to-bubble-performance) today. [[image]](https://gumroad.com/l/the-ultimate-guide-to-bubble-performance) It’s a 156 page PDF available on Gumroad that dives deeply into the hard-earned lessons I’ve learned over five years of full-time Bubbling, focusing on: how to determine whether Bubble is the right tool for your project: the pros, cons and limitations from a performance perspective how to set up your app to load pages, process workflows and edit database records at ma…

> [@Alternative approach to the Bubble’s recent tutorials for list of things](http://forum.bubble.io/t/alternative-approach-to-the-bubble-s-recent-tutorials-for-list-of-things/88724):
>
> Hello everybody, I’ve taken a look at some tutorials from the following topic: In short, I think that these tutorials contain some crucial mistakes. Regarding How To Build A Pinterest Clone Without Code Configure your database User We’re facing this mistake on many apps. That’s a wrong approach since it negatively affects performance and speed. Let me explain why I do think that this is wrong. The Bubble’s unique id for each thing looks like the next one: 1583401182457x36677842…

Hope this sparks some ideas 😀

---

<div class="post-metadata">

**Author:** ![philsim](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/philsim/32/100834_2.png) [@philsim](https://forum.bubble.io/u/philsim)\
**Post date:** [October 20, 2021, 12:04am UTC](https://forum.bubble.io/t/groupings-within-a-repeating-group/174426/6 "2021-10-20T00:04:28Z")

</div>

So for anyone else who is looking to do “groupings” within a data set and it’s not obvious, here’s how to do it.

What wasn’t obvious to me was that repeating grids don’t have to be “database tables”. So I had my priorities in an Option Set, so my parent repeating grids pull those option sets, and then the inner repeating groups pull the repeating group. I’m pulling the main set of data with a search, and then applying filters (both the master filter for the priority as well as additional user filters in a filter on that set).

My page had additional complexity because I had tabs, with custom filters on it and I’ve now moved from 20 database searches to 1! Leveling up 🙂
