Replacing item in the list got from Firebase Database [GUIDE]

Hi Koders, :nerd_face: I was searching on the community about replacing the list data got from Firebase Database, as I didn’t find any guide regarding this, so I thought of to make this guide.

I will be explaining every single block




Step 1
blocks (26)
First we will initialize a empty list global variable to store data (List) temporarily.
__
global_declaration
This block is used to store data temporarily.
__
lists_create_with
Returns empty string to the selected block(s).


Step 2

blocks (27)
When the button is clicked, the data will be got from firebase
__
component_event
This block is triggered when the user clicks on the button.
__
blocks (28)
This blocks get the particular data from Firebase DB.

Tag- Name if the value
Value if not there - Triggered when the given Tag is empty.


Step 3
blocks (29)
When the data is got from DB, we will check if the returned tag is “Names” (In my case) and then set the global lists to the value from DB.
__
component_event (1)
This block is triggered when the value is got from DB.

Tag- Name of the value
Value- Specific data got from the given tag.

__
controls_if
Checks the given conditions are true else it will be ignored.
__
logic_compare
Checks the given data is the same.

__
lexical_variable_set
To replace/store/edit the variable data.

__

Step 4
blocks (30)
When the “Button2” or “edit data” button is clicked, it will check if the variable “List” is not empty. If true then we will use the replace item in list block. We will choose the index or the particular value and replace it with any other value. Then the data will be updated.
__
logic_negate
This block is used to return the opposite of the condition.

__
lists_is_empty
Returns true or to check if the list is empty.

__
blocks (31)
This block is used to replace a particular item in the list.

List- The list in which the value to be replaced
Index - To choose a particular value in a list or the number in order.
Replacement- to replace the value with any other value.

__
blocks (32)
To store/update the data from the given tag.

Tag- Name of the value
Value to store- The data to be stored/replaced



**All Finished Blocks**

AIA-FirebaseListView.aia (2.4 KB)
Thanks, happy Koding!!
Bye Bye :hugs: :partying_face: :partying_face:

8 Likes

This is called as guide good guide .

2 Likes

Great Detail. However, not only the first item, but every item can be replaced.

1 Like

That’s what I mentioned…

@Yash_Agarwal_376 @WatermelonIce thanks

1 Like

Congratulations !

1 Like

Oops :crazy_face:

1 Like

Nice guide.:+1:

I have already applied this in my Social Media Like Post List View aia for “like post” feature. :hugs::grinning:

When user click on like button it will replace the old like value with +1 and store the updated value in firebase.

1 Like

Add firebase image how it’s look like

2 Likes

Nice guide, thanks so much @Xoma for sharing !!!
I can suggest title for this topic ?
[Guide] How to Replacing Item in Listview got from Firebase Database

1 Like

Thank you @bestprintsf @The_K_Studio

2 Likes

I changed the title a bit. Instead of List view, it should be list.

1 Like

Nice Guide Simple and to the point. Keep it up.

1 Like

Nice guide

1 Like

Nice Guide :smiley: Congratulations :grinning_face_with_smiling_eyes::confetti_ball:

1 Like