How to delete a value from a tag

I am developing a chat app
and I want to add a delete option
So, for that we should delete a message or a value from the Chat Tag
Question:
How to delete a value from a tag
Please reply ASAP
Thank You,
Regards,
@SRIKAR_B.S.S

What database are you using?

Sorry for late reply, I use CloudDB

There is a block to clear the tag. But I understand that you don't want to clear the entire tag just delete one of the many values? Are the values in the tag a list? Or a dictionary?

Yes

Yes the tag itself is the list of messages

No, not dictionary at all

Yes, but there is no block to clear a certain value from a tag

Can anyone help me with this

You need to download the entire value list to the app, then remove the selected item from the list. Finally, save the modified list back under a tag.

No I don't want that,
the user himself should delete the message or the value

Well, it is known that the user will do it. When user clicks delete message, your code needs to download message list, then blocks need to remove selected message from list and save new list under tag. There is no block that removes the directly selected item from the cloud list.
There is only a block that removes the first item from the list.

I am Sorry @Patryk_F I didn't got you

It depends on how granular your tags are.

If you keep a list as a value under a tag, and you want to delete an item from the middle of that list, you have to grab the current value of the list, delete the item from the in-memory list, then rewrite the entire list back to that tag, hoping it won't overwrite new items added to the list by other users.

Alternatively, consider extending your tags like

root
  chats
    chat00001
      msg00001: ABG: Hi there!
      msg00002: RDG: WHAT?
      nsg00003:  ABG: Never mind.

tags:values ...
chats/chat00001/msg00001: ABG: Hi there!
chats/chat00001/msg00002: RDG: WHAT?
chats/chat00001/msg00003: ABG: Never mind.

Exactly. There is no other way.

1 Like

Yes My Messages are granular like:

myprofession,MyName:My Message

or

App Dev.,Srikar: Hi, I am Srikar
Power User,ABG: Hi, I am ABG

Thank You for the answer :slightly_smiling_face:

Another way would be to save the conversation of two users under two tags. one user wants to delete a conversation, but this does not mean the other user wants to delete it. Each user should have their own history of conversation.
But as I said before, there is no other way to remove items from the tag than to get the entire list, modify the list, and then save it back.

No its like a public chat:
or more like twitter
anyone can send messages

I think you need to use firebase db because it easily remove a tag

1 Like

No, I want to delete a tag, I want to delete a value from the tag

we can also clear a tag in CloudDB also