Hi there,
I need some help, I’m new on Airtable!
I’m trying to solve a college test.
I have created tables with forms, when filling out the forms and updating the tables I would like to have a button that randomly assigns me roles.
FORM 1
TABLE 1
FORM 2
TABLE 2
I created an automation to give a value Resistance to the Role column.
I have to write a script that randomly assigns a role for each record, the role can be Resistance or Spy.
The total number of roles depends on the total number of players. The total number of players is found in another table.
If the total number of players is 5 then 3 records must have a Resistance role and the other 2 Spy.
If the total number of players is 6 then 4 records must have a Resistance role and the other 2 Spy.
If the total number of players is 7 then 4 records must have a Resistance role and the other 3 Spy.
If the total number of players is 8 then 5 records must have a Resistance role and the other 3 Spy.
If the total number of players is 9 then 6 records must have a Resistance role and the other 3 Spy.
If the total number of players is 10 then 6 records must have a Resistance role and the other 4 Spy.
Thank you in advance!!!