I reduced the code a bit (I’m sure it can still be improved in terms of logic).
Here’s what I did:
we always call a getValue of the relevant node,
and in the gotValue we call the function addItemToFBList.
Since you were running the same function for all nodes, I turned it into a single one, and we pass it:
- the reference tag, so it can rewrite in the tag on Firebase (
tag) - the list present on Firebase (
value) - and the
component(textbox) that contains the value to be written to the DB.
The function
- saves in a local variable
local_listthe data present on the DB; if it doesn’t exist, it creates an empty list - in
textBoxValueit saves the text value of the component we passed to it - if the value already exists in the list, it informs the user that “
TextBox.Textalready exists” (let me know if that works for you) - if the value doesn’t exist, it adds it to the local list
- writes the list in the DB in the
tagnode - message dialog
- then clears the textbox of the component we passed to it
Let me know if this can be a solution, otherwise we’ll come up with something else
.



