Random access to CloudDB

Hi, I am trying to create an application, in which multiple users access from ClouDB to a list with 100 items.
If every time someone accesses an item randomly, is it possible to remove the item from the list so that it's not available to other users?

Yes. Use the clear Tag block to remove the randomly selected item. This assumes you have a list of 100 tags in your cloudDB.

If you just have one tag, which contains a list of 100 items, then you would need to download the list, remove the item from the list, then upload the list back to the cloudDB tag.

Yes, it is a label with 100 items.
I hope that the access of several users almost simultaneously does not create a conflict.
I will try like this.
Thank you for helping.

Your items need unique non-consecutive identifiers that can be used as tags.

The danger of lists comes from their collapsing item numbers when you remove an item from the list, throwing off all the other user's ideas of where in the list their items might be located.

Because of the asynchronous nature of CloudDB getting this correct will actually be rather challenging. If I were to implement this, I'd probably use AppendListToValue block, which performs an atomic update of the list on the server. Then, rather than "removing" items from the list you push a pair of (user, selection) onto the selected list. Because the update is atomic, the order items appear in the final list is the order the server received them. You would then process for a given user if their selection is seen in the list before their user ID. If so, someone beat them to the punch, otherwise they get their chosen item.

@ewpatton means this block (AppendValueToList)


ABG, Users are like poker players, who randomly pick several items from the list (deck). list items should not be repeated.
It works perfectly for me as the only player, the list on the server is emptied if I request all the items, but when accessing with two smartphones (2 players), it does not behave correctly.

Ewpatton, Users are like poker players, randomly picking various items from the list (deck). list items should not be repeated
I understand that the userid is not required, although I can implement it.
I'm also trying it with a publicly accessible Google spreadsheet to avoid using servers.
I will try what you suggest.
Thank you

I would try a bookkeeping model, where you add transactions to a list or sheet for each move:

  • dealer moves Ace of Spades from deck to ABG
  • ABG moves Ace of Spaces from his hand to pile x
  • player moves card from place1 to place2

The location of any particular card or the contents of a hand or pile or deck are determines by scanning the move list.

This approach never deletes during a game.

first save the shuffled deck (a list) to clouddb, then use CloudDB.remove first item block, then no one will get repeat card.

A CloudDB list of player names is a good place to manage player turns.
Let only the player at slot 1 play, then remove him and add him to the end of the list.