Sort by a calculated field / get a list of sums

Hi All,

I’m struggling with something that seems like it should be quite simple. Any help would be appreciated.

In my app, I have 2 data types: Entries, Players. An entry can be composed of 3 players and a player can be part of multiple entries. Each player is allocated a number of points.

Entry A - Player 1 - 3 points, Player 2 - 5 points, Player 3 - 2 points
Entry B - Player 2 - 5 points, Player 4 - 1 point, Player 5 - 8 points

My aim is to have a repeating group that shows a list of entries, sorted by the sum of the entries’ players’ points.

Entry B - 14 points
Entry A - 10 points

I don’t want to use a paid plugin and I don’t want to save the sum of player points to the database

I’ve been trying to use list shifter by @keith. I understand that I can use the sort action in list shifter, but I would have to build a list of the sums of the entries players’ points (i.e. 10, 14). And I can’t work that bit out.

I’ve built a little test app - Sorttest | Bubble Editor

Any help with this or any other suggestions would be very welcomed.

Hi @gavin1! :wave:

You will have to :Group you list (Search for) by “Entries” and in the option Aggregation select SUM and after select the “Points”.

This will generate a list of entries with the sum of points of each entry

I am on a Uber right now :sweat_smile:, but try to search for Group and Aggregation in YouTube. There are some examples…

1 Like

Thanks for the suggestion @rpetribu
I’ve been wrestling with groupby for a while. I think what you’ve suggested won’t work for me because the points are an attribute of the player, not the entry.

I might be wrong. I’ll have another look at the guidance for Groupby

It will be nice to share a image of your database estruture so we can search for a solution that suits you…

If you had a database with 3 columns (Entry, User, Points) I think the issue could be solved using the solution I gave…

I probably misunderstood this structure…

This is the player:

This is the entry:

I could add in a field to the Entry and calculate the total points for all the players related to the entry, but I’m hoping to avoid doing that for performance reasons. This is just a test version. In the real version I have hundreds of players and 10s of entries and the points change regularly so it is slow for a workflow to do the calculation.

I’m trying to do a search that gets me a list of the entries and the aggregate points for all players linked to each entry.

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