Forum Academy Marketplace Showcase Pricing Features

Create groups in a list of players

Hi all!

I’m doing a web app for a tournament where I have a list of players subscribed to a tournament. For each week, I need to create groups of the subscribed players so that there are 4 members in each group, defined by their ranking (highest ranking = best player = group 1).

For example, if I have 12 players ranked in descending order, I would need to have players 1-4 in group 1, 5-8 in group 2 and 9-12 in group 3…

So far I was attempting to do it using an API Workflow that alters a column of the player called “group_number”, but I don’t think of a way of organizing it the way I need to. My idea was to have a state in an element in the page called “index”, so that when the API workflow goes through the list, I send the state index and calculate the group with the formula group_number = index/4:floor + 1, this makes sense to me and should work. The problem is that I don’t find a way of incrementing the index within the scheduled API, since I can only increment once all the list passes with a value of 1.

Any suggestions to solve that state problem or another solution for making the groups?

Thanks in advance!

Made a workaround: had a variable in the database called index and altered that instead of the state. I was able to pass the variable as a parameter in the API Workflow.