Hi guys, I want to make a table of ranking of players. In this table I’ll have four columns:
Ranking, Player, Score, Division
How can I calculate the Ranking column based on first Division then Score?
For example these data objects:
Players in division A will be considered first and then ranked based on their scores, after all A players are ranked, B division will continue the ranking based on their scores. And I need this to be auto updating when there are new entries or updates on the scores and divisions. Is it possible? Thanks!
It is a not trivial task even without relation to Backendless.
(Of course if the data are stored in DB and not in the memory – your case).
So, when the property of any object changes – you have to recalculate rank for every participant.
It can be done just by making the request with ordering firstly by Division column and then by Score column. And then you have to update the records with changed rank.
Hi @oleg-vyalyh, I’m trying to do what you said with event trigger. How do I the the all dataset ordered and assign the new rank to the Ranking column? (I have more than 100 players) Also which blocks can update a whole column?
to load all dataset from the table please refer to this blog article:
Sorting looks correct - does it works for you? You can use the print block to log and debug your logic.
You can iterate through the resulted array and each item in the array will be a single object from the League table.
Just change object to what you need and save it back to the League table, it will be updated.