Dynamic sorting based on people I follow: HELP!

Hey guys,

I am facing some serious difficulties to implement what looked so easy at first: sort repeating group with a dynamic field (sort by thing’s thing). It looks like Bubble deleted this option and there are 2-3 other discussions on this topic but I still haven’t understood how to work around this.

That is why I rebuilt a very simple version of my app for the purpose of this forum: https://bubble.io/page?version=test&type=page&name=index&id=datarankingtest&tab=tabs-1

Short explanation of the demo app:
There are two kinds of data: CITY and USER. 1) Cities can be “liked” by users. 2) Users can follow other users

My goal: I would like to rank the cities by the number of likes FROM THE USERS I FOLLOW ONLY. (that’s where I need help)

Can someone please help me find a working solution? Feel free to preview the app and do some changes if you have the answer.

@NigelG @emmanuel Any chance you could help? Thx in advance!!

Search for users that you follow, and list their unique cities.

Thanks @NigelG, that’s already an amazing step!

Nevertheless, how to rank the results based on the likes from the number of users I follow. If you look at this screenshot below, Lyon should rank on the first position. This is very central for the purpose of my app.

Any idea on how to solve that?


That’s what I’m trying but it doesn’t work. The RG returns nothing at all. Can someone help rank with a dynamic field? Poke @emmanuel @NigelG @romanmg @vincent56 :slight_smile:

Sadly “dynamic field” sounds like it does what you are doing, but it doesn’t.

Dynamic field needs to return the name of a field for it work, it doesn’t do complex fields like that.

To do what you want, you would need a new table which is “cities my friends like” with a total of friends on each one.

1 Like

Sorry @NigelG but I don’t manage to create a dynamic table of “cities my friends like”. Each user will like different cities and each user will follow different users so this database should be very dynamic.

Did I misunderstand your tip or is it simply not possible?

Can you please explain with a bit more details on how you would solve that?

Thanks again

Update for people in a similar situation:

I sent an email to support@bubble.is to get some assistance and here is the reply I have received:

Hi Daniel,

Thanks for reaching out. I recommend adding a field called something like ‘number of current followers’ (of type number) to your ‘cities’ data type. Then, you can add a workflow to your page so that, when the repeating group is visible and the current user is logged in, you make a change to a list of things. Then, in this last action’s property editor, you select ‘thing=city,’ ‘list=RepeatingGroup list of cities,’ ‘field to change= number of current users who like this town (I called them town followers, and then the user followers I called friends) = This town’s list of followers intersects with current user’s friends:count.’ Back on the repeating group, you sort your search by ‘number of current followers’ ‘descending = yes.’ I tested this on my app and it worked. I am attaching screenshots of the relevant actions for clarity.

Please let us know if you have additional questions.



This looked like a good solution! It worked partially but it looks like this wouldn’t be sustainable if multiple users would use the app simultaneously. Laura from bubble recommended me to look into solving that through a Javascript Plugin:

You are right. Unfortunately dynamic sorting is not supported at this stage, although it is on our roadmap. It could perhaps be done through a custom plugin using Javascript, so you may want to consider doing this or hiring someone to do it for you. Many of our users find freelancers on the forum here. You can start your own thread with your requirements or respond to an existing one.

That’s it, I will give it a try with a freelancer and let you know if I come any further.

Sorry for the delay.

Essentially you need to create a “many to many” relationship for every user.

This will intersect your “friends” with their “cities”.