How to sort items on a repeating group based on number of likes

how to sort the list of item in a repeating group based on the number of likes from highest to lowest and vise versa.


Exact solution depends on where your information about the number of likes is coming from. In the database? If so, in the same table as the items themselves?

But in any case you can determine the order of items when choosing the data source for the repeating group.

  1. Use the “Search for [YourDatatype]” option
  2. Select the data field you want to use for ordering the items in the “Sort by” and “Descending” input

Do as above , in addition you might want to use ‘‘by changing which field option’’ and dynamically sort the post as you like. So, you wont be fixed to number of likes descending , number of likes ascending but post date or post most viewed.You will need to specify an option set for that and display as field name and yes/no for addtional attributes for descending or ascending. Examples of those are option1 - field - like_count desc-yes , option2 field- like_count desc-no ,option3 field - Creation Date desc-yes option4 field - Creation Date desc- no . Here field and desc is attributes of option set , and default as display which displays will be what you want your users to see in a dropdown.

In this case you will need like_count under your data type . Make sure your field attribute exactly matches your data types name

I think you are asking about using a List within a Thing and then trying to use the list count to sort.

Bubble does not allow you to process this during the data retrieval. Hence, if you create a field “Likes” that is of type User and you add a User to the Likes and want to count them up, you can, but not at the time of retrieval (and sorting). These kinds of restrictions are throughout Bubble. You can’t even group on this kind of information. Very frustrating.

There is a plugin called “Repeating Group Sort” that can be used. This will allow you to define an element within the repeating group that can be used to sort the entire repeating group. It is very handy.