Forum Documentation Showcase Pricing Learn more

Sorting Repeating Groups That Use :grouped by?

Hello everyone!

Has anyone found a way to sort a RG that’s using :grouped by in a way other than alphabetical?

In my case, I have meal deals that get grouped together when there’s the same meal deal listed multiple times because it’s offered at different restaurant locations. As such, my results show alphabetically by the restaurant, as that’s what I’m grouping them by.

I would love to organize these by the distance the deals are from the user (which can’t be stored). @romanmg, I was attempting to do a method similar to what you have here - any other ideas?

already ask, but no response

The ugly turnaround I had to use is creating another field like “Sort_number” on the Thing I want the aggregated result to be sorted, and then use an AVERAGE on it.

1 Like

Yep, I do something similar now. Since the distance will be a dynamic value that can’t be stored, I’m looking to do another approach.

Hi all,

After lots of trial and error, I found a way to sort a repeating group that uses :grouped by!

What you have to do essentially is create your repeating group normally like you have been, and use the :grouped by like normal. However, in each cell of your repeating group, you need to add another group. You can then set this group to be the elements you need by using the repeating group as a list of data, and matching it against search results, using the cell index to create the new list.

Since this is very confusing, here’s a screenshot of how I set up that group that’s in each repeating group cell (group on the right, search being run on the left):

I can now sort by any field for my data types! Hope this helps :slight_smile:

1 Like

Hi @callen.hedglen, are you still using this method?

I’m so confused by it that I haven’t been able to bring myself to try it. So having a group inside the repeating group allows you to change the order of the repeating group? I guess I’m not understanding how that’s possible for a child group to influence its parent repeating group like that.

I’m afraid the solution above performs a request Do a search for for each cell of the repeating group. If so, it may work but is not efficient