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.
e.g.
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.
e.g.
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.
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
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.