Auto Updated General Table Ranking

App ID:D3828E7D-B42E-B69F-FFFC-EFE55E612400

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:
image

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?

image

Hi @Louis_Cadier,

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.

Regards,
Stanislaw

Thanks @stanislaw.grin I made it work with your suggestions!

Great to hear it @Louis_Cadier!
You’re welcome!

Hi @stanislaw.grin

Although it works but it requires too many API calls. I opened another question thread asking if there is any way to update all objects with bulk API methods. Can you have a look? Thanks!

Hi @Louis_Cadier ,

Hope all is well. Would you mind sharing a screenshot of how you solved the ranking and the block you used to update a whole column? Im new to this :slight_smile:

Thanks in advance.