Shuffle record in another table

G_S
Bronze 3
Bronze 3

I am having a table called Player List
Player list table contain the fields Name, Email ID, Date ,phone number

I am having another table Match fixtures
In this table I have fields ,Team 1,team 2
What i am trying to achieve is I need the player list shuffled in Match fixtures table in the fields team 1 and team 2
Any idea to achieve this,when i like a action else save a player list form

0 15 313
15 REPLIES 15

To the best of my knowledge, thatโ€™s not possible.

Just to clarify, are you wanting to randomly assign players from the the Player List table into the Team 1 and Team 2 columns of the Match Fixtures table?

Sorry, but itโ€™s not clear at all what you are asking/saying in the last part of the statement above.

@WillowMobileSystems
John,
Provided I have understood his request correctly, he wants the dropdown list content to be in randomly shuffled order rather than asc., desc., or in the list order. AFAIK, thatโ€™s not possible.

If the dropdown is a list of Ref values, one can shuffle the list with a Valid If expression like:

ORDERBY(list-of-ref, UNIQUEID())

Thanks @Steve, thatโ€™s a very good point. As the query was about team players, I havenโ€™t thought that it could be a ref. However, if thereโ€™s a Players table and itโ€™s referencing that table, you may have a right indeed.

I would agree with both of you except it would only work once. Since this seems to be a game, likely there will be a need to periodically re-shuffle???

I believe the only way to provide a regular shuffling is to add a random number generating column to the players table which will always regen those numbers when a new Player record is added:


And in the app it can be constructed like this:

I need to add a random column in player list ,it will add in player table,
I am having a doubt, the matches records will automatically create when I add a new record in the player list table
Correct me if i am wrong

Sorry but I couldnโ€™t be able to understand your question. Can you please re-phrase?

If new player is added to player table with all column including random column

In above sample application i am seeing one record in match table ,
My question is
It is automatically created when a new player is added .

Iโ€™m sorry but I cannot follow you totally. The app preview I had posted was just a PoC of what you are asking up-to a certain extent on how could it be done.

Iโ€™m totally unaware of your app build, your tables, your table schemas, the relationship of your tables etc.etc. So may I humbly ask how can I answer your question?

Sorry but your question is a bit ambiguous.

I am having a table Player list
Columns

  1. ID
  2. Player Name
  3. Email ID
    I am having a table Match
    Columns
  4. ID
  5. Team 1 - Ref player list
  6. Team 2 - Ref player list

Its possible to add a player list shuffled in match table column Team1 and Team2 ,when I add a new player in the Player List table.

Yes of course. The [RND] column is there just to provide that. The numbers in that column are not static and when you add a new Player record to the Players table, those numbers will be regenerated automatically because of the ArrayFormula in cell B1. Notice the change in numbers in my demo sheet when I add a new player to the players table.


3X_d_1_d1ccf32113ae40209950847955400935a997c02e.png REMINDER


Provided you add this [RND] column to your sheet and regenerate your table structure, expand the column structure for this column in the App Editor and clear away the SheetFormula value.

To answer this questionโ€ฆno. AppSheet never automatically adds rows to tables. You would have to implement some action or workflow or use an input Form to add rows.

If you are finding that a row is being added to the Match table when you have added a new Player, then there must be some action or workflow that is being activated to make that happen.

Ah understood. And I agree that it is not supported directly - nor would it ever be.

However, you can build something to achieve it. For example, you could add a Sort column into the Player List table. Randomly assign an index into that Sort column for each Player. Then sort the Team 1 and Team 2 lists based on the randomly โ€œshuffledโ€ player list.

This might require some slight design changes to support but I think it can be done.

Top Labels in this Space