How do I delete an item from cloudDB?

i am trying to make a chat app but i want to delete an item from a tag called "players". how do i do it?


In retrospect, the answer would depend on what you have store under tag 'players'.

Show how you store player data.

This block will clear the tag and its contents


If the content of your players tag is a list, then you need to call back the tag value, edit the list, then store the new list to the tag.

I am making a chat app and I need to code a block where the app removes a username from the playerList once the app is closed. How do I do it?

it doesnt work. the username is still on the list

Show us the blocks that add the user to the list.


Storing the player names as a list under tag 'players' is an unfortunate choice.

Maintaining such a list in a shared environment becomes very tricky.
To remove an item from such a list, you have to

  • Make sure no one else is going to work on that list while you are
  • get the list into a variable
  • locate the player name in the list
  • remove that list index
  • rewrite the entire list to CloudDB
  • tell every one else that you are done working on the list.

To avoid this difficulty, you could use a nested tag structure for your player names:

  • players
    • ABG : true
    • warrior23 : true
    • ...

So my player tag would be 'players/ABG', and all that would be needed to remove me would be to clear that tag.

Could you post an example with blocks, I really need it.
I edit mine

Text boxes are empty or default in Screen 1 initialize.

Further answers require you to explain what you are trying to do, and how your CloudDB tag.value setup relates to that.

Hi, ABG: I'm not sure I understand how to implement your choice for a nested tag structure: do you mean using a dictionary structure for the tag "players"?
What item do we store for this tag then?

Storing a list of usernames under a tag "players" looks easier for me to understand, but it has the problem that you pointed out of having users simultaneously trying to remove a username from the database. Would it be possible for you to post a simple example of how to keep a list of usernames in CloudDB and how to delete one user from the list?"

Short answer:

Use a tweezers, not a shovel when storing data.

Longer tags with multiple levels separated by '/' are needed to reach fine grained data.

I think I understand it now: the point would be to store the players' names in the tag, not in the value. Then you could retrieve the list of players with GetTagList().

1 Like