Firebase DB Append Value

image

“FirebaseError: Previous value was empty.”

The value is a list and is not empty… why do i always get this error?
The Append block do not work like that?

image

2 Likes

Tenho o mesmo problema e nao consigo resolver.

También tengo el mismo problema alguien que nos ayude por favor

I was facing the same problem and was able to verify that the error “Previous value was empty.” It jumps only on the first try, when you try to add the value to the list for the first time, if you try it a second time, it does the process smoothly.
My solution to handle the error, with the firebase error block, condition it by saying that if the message is = a Previous value was empty. that it perform the process of adding value again and in that second attempt the value will be added without problems.

Cheers
I hope I make myself understand well, and this solution will help you … sorry for the English, I use the google translate

Hi @storkgdev, This suggestion may work

Step - 1 Creating a Realtime Database
Go to firebase console create a new project and add a new Realtime Database
Remember to change the rules, given below

 {
   "rules": {
     ".read": true,
     ".write": true
 }
 } 

Remember to Publish the changes.
This will help to get and write the Data

Step 2 - Connect your Firebase to your App

  1. On the Firebase Database at the Data,

  2. Copy the URL,

  3. Go to Kodular and Paste it on Firebase URL

  4. On the Firebase project left panel,

  5. You have a Setting Icon,

  6. Press on it and menu popups,

  7. Press on Project Settings,

  8. You would be redirected to a new page,

  9. Copy your Web API,

  10. Go to Kodular paste it in the firebase token.

Step - 3 Blocks
Set your Blocks as the following

Firebase Database Solution Blocks - 1

Firebase Database Solution Blocks - 2

Firebase Database Solution Blocks - 3

These blocks means that
When the Screen starts the firebase gets the value of a specific tag and if the value is not there it will create an empty list.
After the Firebase gets the value it checks the tag, if its the correct tag then it will check its value, if the value is create empty list which means that there is not value it will store an empty list
Now when button is clicked it will append the value as already the value has been stored thus previous value empty error will not appear.

2 Likes

This will help you,