[Solved] How to take nested value from FIrebase

How can I take this value from firebase as a list to show it in a list viewer
image


image

This is not working :arrow_up:

Firebase will return an object not a list so use the methods in the object drawer.

Note
It is always a good practice to first check for errors before proceeding with reading values

1 Like

Ok, Thanks :grinning: :grinning: @muneer

Can you please share a screenshot of getting this values using the objects block?
actually I have never used those.

1 Like

Will do it later when I’m in front of the computer

Ok, please send it by today

The link below shows how to get and set nested values from a firebase json tree. Basically, use a slash to separate nodes in the tree.

1 Like

How can I use this method to get the values in a list form?

1 Like

@drted How can I get all the values from that list? Like if it has 12 participants it will all of them but if it has 5 participants then it will take those 5?

image
I have figured it out!!
Here app extra is the number of participants (counting from 0 not 1) and the textinput holds the first key. And the list is getting saved in the app temporary list.

1 Like

@roumak-coder,

Excellent! I’m glad to have a better understanding of how firebase works.

Something to consider, you can do the same thing with these 2 blocks:

image

Fewer blocks and it will run much faster!

3 Likes

Wow, that’s great. That means in place of Firebase DB I can use an cloud variable. Am I right?

100%

1 Like

Great,
The list is practical in this case because you have only names but when you have something like user name and email address then you will need to look at it as a JSON object instead if a list

I made a quick app and used similar entries in you DB to simulate the situation. The [get object properties of] will list the numbers that are not shown if you use the list.

image

Hope that clarifies why sometimes you need to look at at as a list and another time as an object of a list.

1 Like

Hey @muneer and @drted thanks for helping me out!! :smile: :smile: Just a quick question, that if I create a cloud variable will it be saved in firebase DB? and can I take that data using the same cloud variable?

1 Like

If you have the Web API Key and Database URL set in the project setting page then it will be saved to your Firebase DB.

In case you have not supplied your database credentials, then it will be saved in the cloud storage of Thunkable cloud which is temporary only.

Hope to have answered you.

2 Likes

Ok, Thanks

1 Like