Forum Academy Marketplace Showcase Pricing Features

How to create sorting by count of matches?

Hey everyone! I have list of user… Each user has the list of interests. I want to display to RG the of users who has at least one match and sort it by count of matches. Finding users with matches is done , but I can’t figure out how to sort it, please help me!

Thanks!

You might find some helpful discussion here: Sort By list of items:count in Repeating Group - Need help / Database - Bubble Forum

If the solution discussed here isn’t your use case, then you may need to use a plugin (I think list shifter may do this).

Thank you! Could you share how did you do that in your case? It’d be great to look at editor if it’s possible… I tried to do the same for mine but can’t understand how to make it…

You’re welcome. From what you’ve posted I can’t tell exactly how you’ve set things up. If you post more details I will try to take a look.

Dropshipagent | Bubble Editor - 4 July 2022 (loom.com)
There’s explanation of my case.

Hi, I’m not an expert on this topic and haven’t tried this type of sorting in my app. However, a few things which may help you…

  • In general, native Bubble can’t do much in the way of sorting on a calculated field. I recall people on the forum resorting to workarounds, including plugins (I think List Shifter and also BDK, though not sure since I don’t use those). But if you search the forum for sorting on a calculated field you’ll find some threads.

  • The post I referred you to discussed Bubble being able to sort on a calculated field when it is part of the “grouped by” function. Since you aren’t using this function in your setup, it wouldn’t work for you.

However if you want to explore it, try the below…

In a repeating group of data type “X” put in “X” as your Type of content and in your Data source put in Seach for X:grouped by

This will change the Type of content to “Grouping” and open up a Group by box where you can specify the field to group by, and also lets you do an aggregation (like count or sum).

image

image

Then put “sorted” at the end of that expression and it will let you sort on that aggregation.

image

Thank you, but it doesn’t work in my case. This structure can’t sort by calculated value like count of intersect items with another one object.