# RG Sorting - Similar values first

**URL:** <https://forum.bubble.io/t/rg-sorting-similar-values-first/103103>\
**Category:** App Organization\
**Created:** [July 23, 2020, 3:48pm UTC](https://forum.bubble.io/t/rg-sorting-similar-values-first/103103 "2020-07-23T15:48:27Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![vnihoul77](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/vnihoul77/32/241345_2.png) [@vnihoul77](https://forum.bubble.io/u/vnihoul77)\
**Post date:** [July 23, 2020, 3:48pm UTC](https://forum.bubble.io/t/rg-sorting-similar-values-first/103103/1 "2020-07-23T15:48:27Z")

</div>

Hey!  
Is there a way to sort a RG like this :

- **Date source:** User’s likes
- **Sort by:** this item User’s likes is in Current User’likes

To have the values matching coming first…  
Thanks 🙂

---

<div class="post-metadata">

**Author:** ![ed727](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/ed727/32/71942_2.png) [@ed727](https://forum.bubble.io/u/ed727)\
**Post date:** [July 23, 2020, 4:25pm UTC](https://forum.bubble.io/t/rg-sorting-similar-values-first/103103/2 "2020-07-23T16:25:21Z")

</div>

I’d also be interested in a solution to this. It’s also discussed in this thread with a manual workaround as an imperfect solution.

> [@Best Intersect between 2 lists](http://forum.bubble.io/t/best-intersect-between-2-lists/99377):
>
> Hello! I have several “accounts”. Each account has a “list of categories”. I want to select an account and get the other account for which the intersect of their “list of categories” returns the maximum count. However, I’m stuck. I am able to get a filter in place with the intersect count \>0 but am not able to get the account whose list of categories has more in common with the current account. Can anyone help me out?

---

<div class="post-metadata">

**Author:** ![vnihoul77](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/vnihoul77/32/241345_2.png) [@vnihoul77](https://forum.bubble.io/u/vnihoul77)\
**Post date:** [July 23, 2020, 4:49pm UTC](https://forum.bubble.io/t/rg-sorting-similar-values-first/103103/3 "2020-07-23T16:49:40Z")

</div>

@ed727 Thank you for answering.  
I just check, unfortunately this solution would be not working with my current data organization…

---

<div class="post-metadata">

**Author:** ![keith](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/keith/32/56020_2.png) [@keith](https://forum.bubble.io/u/keith)\
**Post date:** [July 23, 2020, 5:00pm UTC](https://forum.bubble.io/t/rg-sorting-similar-values-first/103103/4 "2020-07-23T17:00:06Z")

</div>

You can do mapped sorts like this using List Shifter’s SORT action.

> [@Sorting according to a Thing's Thing field](http://forum.bubble.io/t/sorting-according-to-a-things-thing-field/7208/18):
>
> List Sifter’s SORT action does this. Put List Shifter on page Set its “List to Shift” as the list you need to sort. Fire the SORT List Action at it. For “Source Sort List”, just compose the Thing’s Thing’s field. List Shifter’s “Shifted List” output now contains the sorted version of the list. Example: Here’s an explorer page demonstrating this basic use of SORT in List Shifter: [https://list-shifter-demo.bubbleapps.io/version-test/mapped-sort-basic?debug\_mode=true](https://list-shifter-demo.bubbleapps.io/version-test/mapped-sort-basic?debug_mode=true) And [here’s the …](https://bubble.io/page?type=page&name=mapped-sort-basic&id=list-shifter-demo&tab=tabs-1)

> [@The not possible sort repeating group by](http://forum.bubble.io/t/the-not-possible-sort-repeating-group-by/100785/8):
>
> Hey @casheets123, I made exactly the demo scenario you described. I’ve not made a video explaining this yet, but see my text on the page and examine the editor to get an understanding of how its done. While doing this, I realized that it was WAY harder (in this exact example) to figure out how to turn the list of Paints into a list of counts of those Paints than it should be. So, I did it the hard way first (that’s the link I share here) and then I updated List Shifter with a new function that …

> [@List Shifter: Reverse, Rotate, Swap and ITERATE (Loop) Over Bubble Lists | Now Part of Floppy](http://forum.bubble.io/t/list-shifter-reverse-rotate-swap-and-iterate-loop-over-bubble-lists-now-at-v1-4-adds-numeric-option-get-index-action/56237/177):
>
> Hey @gavin1: Well, thank you for your support! So there’s a much faster way to do this (and sorry it’s taken me a while to respond). You’re correct that it involves the SORT action. What we would do is take a list of random values (52 if you have 52 cards in your deck, for example) and then SORT the deck by that list. List Shifter makes this super easy, and I’ve created a demo page for you: The [editor is here](https://bubble.io/page?type=page&name=mapped-sort-shuffle-cards&id=list-shifter-demo&tab=tabs-1). There are actually 2 “random” functions in List Shifter and I demonstrate usin…

---

<div class="post-metadata">

**Author:** ![ed727](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/ed727/32/71942_2.png) [@ed727](https://forum.bubble.io/u/ed727)\
**Post date:** [July 23, 2020, 8:09pm UTC](https://forum.bubble.io/t/rg-sorting-similar-values-first/103103/5 "2020-07-23T20:09:51Z")

</div>

Many thanks – will check it out.

---

<div class="post-metadata">

**Author:** ![devease](https://sea1.discourse-cdn.com/bubble/user_avatar/forum.bubble.io/devease/32/241172_2.png) [@devease](https://forum.bubble.io/u/devease)\
**Post date:** [August 12, 2020, 1:02pm UTC](https://forum.bubble.io/t/rg-sorting-similar-values-first/103103/6 "2020-08-12T13:02:27Z")

</div>

You can also do it by interstecting similar values in an hidden RG.  
And then Showing the result of the hidden RG merged with the values you want to show.

 ![sort values](https://us1.discourse-cdn.com/bubble/original/3X/b/4/b4a94ef7de3360c1fcaa4cee6a5f4fd13cea30e1.jpeg)
