Simple question about sorting a list

I’m making my first bubble app, in this app i have a simple repeating group with items that are assigned with a score field. I want to display the items according to their score in a “best” sorting, because i still don’t understand how to sort a list (like how the items on top disappear after a while)
THankyou

Hi there,

So in your repeating group, you would have set a ‘Type’ and ‘Data source’ - I imagine you have used in the data source ‘Do a search for’ and pulled in a data type, which contains your items and importantly has the field ‘Score’ which would be a number type.

An example is below, but what you’ll want to do is set the ‘Sort by’ to the Score field and then if you want the highest scores to be loaded first and then descend to the lowest score, make sure Descending is set to ‘yes’ (this field requires either a yes/no).
image

If you wanted to go a step further you could also add more sorting fields, such as adding another sorting field by the ‘Creation date’
image

So what this would do is again display the items from highest to lowest score, but it also factor in the creation date of the item. This could handy if you have 2 items in the list with the same score. So in this example it would display the most recent item with the same score first (in higher order).

Quick example (error handling item was created most recently, therefore displays higher on this list):
image

If you haven’t used the ‘Do a search for’ and in the ‘data source’ you have used something else e.g. custom state, another repeating group - you may not see the Sort by integration. To add this on you just need to click in the data source and more. Then you can added an expression for ‘:sorted’.

image

Hope this helps.

1 Like

Thank you!

Hello again, I hope you’re doing fine! If it’s ok i’d like to ask you a few other questions!
First, I have a repeating group where the user can click on a single post from that list which would show another group where he can read or comment on the post he clicked on, I’m kinda confused on how to set your new group to show that particular post he clicked on and get information alongside like the comments and such.
Also, I want to set a dropdown button next to the repeating group so that the user can change the conditions of how the list is sorted, but i found that difficult as well :3
I really hope you can help me here, thank you again.

1 Like