How to update a stored local partial list on Firebase

Hi, i’ve a problem: I’ve a series of object on firebase, of all the users. I’ve stored locally same object to use without connection (onlyone the user had stored). How I can update the local list when firebase change? I dont want to store all the record locally! I try with a Loop, with listener, with “for each”, but the local list don’t upload (or randomly). In the object I created a field with 2 index, local and firebase… but dont work! Thanks

You need to use a listener for the desired object node, and then save the change when the listener is executed in the stored variable.

Thanks, I’ll try, but i’ve to add a listener for each local record? is not a problem to create multiple listner (one for each object)? can I do it with a loop?

I understand correctly that you want to save only the data that relates to this user on the user’s device? If this is the case, then you need to create a cloud variable with a mutable name that will be populated during user registration. That is, the pathname in the listener depends on the user ID in the database.

And for what purpose I do not understand the use of the loop.

The cloud variable has a block like this.

Try adding one to your project and then open the variables drawer - you will now see a new “when data changed” event listener.

thank you, I used the listner and I (you) solve :-)… can I ask you about using Cloud Variable? How I can Show in a list viewer the field of all the object inside the record (or, if is possible, how I can filter the record?) I want to show all the record with a control field setting to 0, I can use “for each items”, but i need to store on another local variable… Thanks

1 Like