Firebase DB,overwriting instead of appending

210 views
Skip to first unread message

ZAIN AHMED SHARIFF

unread,
Jul 3, 2017, 2:34:12 PM7/3/17
to MIT App Inventor Forum
I have issues with organizing data on firebase!
can anyone suggest some JSON or any other thing which would allow me to record and append user input data into firebase DB.

Data is a couple of concatenated strings(not a list).

 please tell how to make entries not overwrite previous data in firebase DB , 
I've got it to store from 'storeValue' function, and when used to store again it overwrites previous data.

gerrikoio

unread,
Jul 4, 2017, 5:30:14 AM7/4/17
to MIT App Inventor Forum
When using the Firebase storeValue function, Firebase will overwrite the values, if it finds the same child or tag name in the database projectBucket. If you use a new tag name then Firebase will automatically create a new record using that tag name as a child node.

If you're wanting to add to a list of items linked to a tag name in Firebase then use the appendValue function.

ZAIN AHMED SHARIFF

unread,
Jul 4, 2017, 12:02:26 PM7/4/17
to MIT App Inventor Forum
Thanks for the reply gerrikoio !


I'm attaching my 'string' code.

How do I set up the firebase or invoke the store value function to add this data, and further data that is added should be next in index and follows.
I tried storeValue, it worked the first time, but when invoked second time,data was overwritten in db,
and when i used appendValue function, an error was displayed,saying 'no file found to append' and quite understandably.

I chose .txt file as a temporary alternative.
Capturecode43445.JPG

gerrikoio

unread,
Jul 4, 2017, 1:11:46 PM7/4/17
to MIT App Inventor Forum
Your graphic is showing "AppendToFile" which is a File method and not a Firebase method.


ZAIN AHMED SHARIFF

unread,
Jul 4, 2017, 1:57:05 PM7/4/17
to MIT App Inventor Forum
yes it does, because i had chosen offline file storage on phone memory as an alternative which was a consequence of firebase problem i had 
mentioned as before.


nonetheless, i have figured out a workaround that serves my purpose well.




 it is 'dirty' no doubt , but serves the need of my application :P  I just wanted to store data in db , not query from it.

pardon me for my inability to work with JSON.
Thanks gerrikoio :)
Reply all
Reply to author
Forward
0 new messages