Doing a search for users

Hi Forum,
I’m creating an app which has users which can follow/unfollow each other.
In my “user” datatype, I have the “following” column which is a “list of users”.

I’m trying to list follower’s profile picture of each user, but am having trouble displaying the data the following way:

Edit I’ve also tried:

Any hints or ideas? Thank you.

Use a repeating group whenever you want to list things.
The repeating group will list all the followers of the user. (Set the data source of the repeating group as the list of followers)
In your case the list of followers will be “Search for users: Following contains Current User”

In the repeating group itself, place the image, and set the file as “Current Cell’s User’s profile picture”

Now that you got it working, i wanted to give you a heads-up that the “:do a search for followers” that you are doing is going to be very slow and wont scale at all if you have many users.

You are asking the database to go through every user in the database, and check whether the current user is contained in their followings list, which could potentially be a very long list. This takes a while.

A better way of doing things would be to have a “followers” list of users attached to the user type alongside the “followings” list. So you dont need to do that ugly search for Users to get the followers, just set it as Current users followers.

There are even better and more scalable ways of organising the database, but the above solution should easily scale for the time being.

This topic was automatically closed after 70 days. New replies are no longer allowed.