Hello, thank you for your answer in advance.
I know that it is kind of a common question, but I still can’t solve this task.
I’m doing a common leaderboard by marks in a repeating group.
In my database, I have users which are connected with the list of Marks type.
Marks type has:
-
Number of the task (number)
-
Who are being evaluated (User)
-
Who created a mark (User).
-
Mark (number).
So, I want to do a leaderboard in the repeating group. The first column in this leaderboard – name of the user, the second column – the sum of all his marks.
Could you help me, please?
1 Like
In the “Sum of marks” text box put the expression:
Just to follow-up on that. If you’re wanting to do a leader board so that the user with the highest marks is at the top of the list you’re going to have a tough time sorting it in that order relying on the marks stored in a Marks list on the user. I’d advise instead storing a User field on the Marks data type instead. That way it’s really easy to sort by the number of marks and reference it.
This is then the data source you’ll need to set on the repeating group
When setting this up make sure you don’t set the Type of content to anything first otherwise you won’t get the necessary options as you’re building the Data Source expression. Bubble will automatically set it to type Grouping after you’ve specified the :grouped by
When you select the :grouped by function you’ll set the following in the dialog that opens
When you select :sorted by make you set the Descending option to “yes” so the highest number appears at the top.
Then in the text that you want to display the number of marks for each user, you’d just enter
As you’ve access to the full User type through the grouping, you can use any of it’s fields to display elsewhere in the cell eg
Hope that helps.
2 Likes
Thank you so much. It works!
1 Like