# Sort Repeating Group

**URL:** <https://forum.bubble.io/t/sort-repeating-group/225695>\
**Category:** Need help\
**Created:** [September 24, 2022, 8:35pm UTC](https://forum.bubble.io/t/sort-repeating-group/225695 "2022-09-24T20:35:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![marco.mueller](https://avatars.discourse-cdn.com/v4/letter/m/e68b1a/32.png) [@marco.mueller](https://forum.bubble.io/u/marco.mueller)\
**Post date:** [September 24, 2022, 8:35pm UTC](https://forum.bubble.io/t/sort-repeating-group/225695/1 "2022-09-24T20:35:52Z")

</div>

Hi there,  
I have a RG, type User, which lists some Chat Members just like Whatsapp. I also have a table with the type Messages. Now I want to sort the list of Users by the last message. How can I achieve this? I have already added a hidden field with the last message and its creation date. But I’m only able to sort the RG by the type User. Thank you very much for your help.  
Cheers Marco

---

<div class="post-metadata">

**Author:** ![building4stripe](https://avatars.discourse-cdn.com/v4/letter/b/779978/32.png) [@building4stripe](https://forum.bubble.io/u/building4stripe)\
**Post date:** [September 25, 2022, 1:16am UTC](https://forum.bubble.io/t/sort-repeating-group/225695/2 "2022-09-25T01:16:29Z")

</div>

Hi Marco. My understanding is that you want to list users by the last message they created in a group conversation. The answer here depends on your data structure, but here’s how I would set it up:

Two data types: “Message” and “Conversation”. Every message has a “Conversation” field.

The RG’s data type should remain “Users”, but you should “do a search for” the “Message” data type. Filter Messages by a specific Conversation. Then Sort by “Created date” and set “Descending” to “yes”.

 ![Screen Shot 2022-09-24 at 6.12.21 PM](https://us1.discourse-cdn.com/bubble/original/3X/8/6/863286f4198b14985fe161106715287ec79a7603.png)

Now, select “each of” the search items’ “Creator”, followed by “:unique elements”, which will remove all the duplicate users if each user has sent more than one message.

![Screen Shot 2022-09-24 at 6.15.45 PM](https://us1.discourse-cdn.com/bubble/original/3X/8/6/867fcaf91b36723ef0a5490119b4689760b7be7a.png)

Hope that helps!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/bubble/original/3X/2/8/2847faa74692c2ffa5d939d3dc3724cdd060d247.png) [@system](https://forum.bubble.io/u/system)\
**Post date:** [December 3, 2022, 8:36pm UTC](https://forum.bubble.io/t/sort-repeating-group/225695/3 "2022-12-03T20:36:08Z")

</div>

Closed on December 3, 2022, 8:36pm UTC

This topic was automatically closed after 70 days. New replies are no longer allowed.
