[Solved] How to get get rank/index of a user's thing from search?

Hello folks!
App: I’m building a simple referral contest app where users get points for each referral. The total score (sum of points collected) is saved in a numerical field on the user data type, and its value increased with each referral. The users are ranked based on their scores. At the end of the contest, the user with the most points wins.

Issue: While the contest is running, (in order to push them for more referrals) I need to display the user’s rank (based on the score) in their dashboard. This is what I can’t seem to figure out.

I am an intermediate bubble user. Any help will be much appreciated :slight_smile:

1 Like

I found the solution in plugin “1 Thing” by Eli. 1T - Index Finder Plugin | Bubble

It was a little bit tricky but I got it working as expected.

Step 1: Run the Find index(Backend) action with the following parameters:

Step 2: Save the result of the 1st step in to a custom state (in my case it’s a custom state on the page element. Page’s Name is giveaway).

Step3: Display !!

A big thank to @eli for the Plugin :slight_smile: :grinning:

1 Like

@eli there is a minor issue with the results that I need help with, if possible.

If two users have the same score, one of them gets indexed higher than the other. I know it may be due to the bubble’s search index, however, any workaround would be great :slight_smile:

I just realized that I had overcomplicated things :man_facepalming: :woman_facepalming:

The solution was as simple as:

This also solves the issue arising with two or more users having the same score :slight_smile:


Good morning ! I’ve got a big problem. I have a list of users (RG), I manage to display the ranking with the index. My objective is to display the position of the current user in the list. I use the solution found, but the problem is that when 2 people have the same score they have the same position. And I don’t want that. I want to display by creation order. So even if two people have the same score, I want the one created first to be in front of the other. How can I do that ? Thanks !!!