How do you make a seamless append to a Firebase list?


When I run this sample program and look at the FDB it looks like this:
image
It is [...[...]] so when I read it back I get it like this:
cow
dog
cat
(lion tiger)
The list length comes out as 4. So I do not have index to the appended list.
Q1: How can I append but still get it correctly?
Q2: If FireDB had the AddValue feature like in the Addlist then it would have been perfect. Are there any extensions I can install to get this extra feature.
Thanks a lot

The answer is there really, "AppendValue", not "AppendValues".

Send items one at a time. You could make a small procedure to send many new items to append, or build the entire list on the app and replace the existing list.

1 Like

Try this in order to work with append. When Screen initialize set firebase to get the value of the specific tag . After the Firebase gets the value check if the tag is the correct one and then check its value.If the value is empty then store an empty list else get value.
Now when button is clicked it will append the value of textbox in list.

image

2 Likes

For a tag/value database without native list support, I would turn list items into subtags, assuming unique items and lack of sort order considerations.

  • animals
    • dogs : 2
    • cats : 2
    • dinosaurs : 0
1 Like

Thank you very much Dora. This works like a charm. No those extra []. Im y actual program I do lot of appends and I was running into so much issues indexing them. Now it works like a charm and the example you gave was really helpful. This MIT app has amazing possibilities . Thanks to TimAI2 and ABG for other ideas too.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.