I am wondering if i could pull all the parents and child data in firebase in list in thunkable app?
Wouldn’t you want the lists separated by data path? Otherwise you will have a list of everything?
You will likely want to parse or filter your data somehow right?
I’m also interested in something like that.
How can I retrieve the list of my bucket children ? For instance a bucket named users_list containing the list of users.
I’m not able to retrieve it either in a variable or in a list viewer. I get something like [object] [object] . I can’t understand the error.
Thanks for your reply!
it all depends on your data stucture.
for example, here is one way to do it
and here is another, equally as difficult/easy which i like better
Use a cloud variable and link a firebase database and do you can fetch all the data. Here is how i did.
Uploading a data to firebase
Guys I cannot get the point… I tried your example but it seems different from my needs. I try to explain it better:
Let’s say that I have a Firebase project “school” , then I have a list of classes , and for each class I have a list of student.
– Class A
– Class B
– Class C
– Class Z
How can I get the list of student of Class Z ? I need to save it in a variable and show the list in a list viewer.
Thanks a lot!!
Can you please let me know if students name do have definite keyname for each value?
Student John as value John , student Anne value Anne and so on…
this is my first time in creating an app, posting in a Community and using Thunkable (I started 20 days ago). I hope you will forgive my English and my mistakes.
I answer to your post because it seems to me that the topic is similar. It also seems to me that you are very experienced and maybe I can ask you for a suggestion.
With my app I would like to create a database of stores and allow users to select them by type and city.
I managed (perhaps not in the best way) to finalize the registration of the shopkeepers and to allow them to save the data of their shop.
This is an example of the shops data:
Then I have created a list of the merchants’ userIDs (which I call Tag.List)
These are the blocks that create the TagList (which works):
(I copied them from a @Darren Tutorial)
Now I would like to create some sublists: one for each type of shop, but I can’t do it.
These are the blocks that should create the sublist of a type of stores (in the database the property corresponding to the store type is “2”) but they don’t work: they always produce an empty list.
Can you help me understand where I went wrong? Thanks in advance.
Tonight I wondered why MIT App Inventor (which I tried before Thunkable) uses two different blocks to read data from a database: “GetValue” (call) and “GotValue” (receive). Maybe to give the app the time to receive the requested data? Thunkable only uses one block (Get)… so I tried to insert a pause before evaluating the answer.
And it WORKS!
Hey @bellacopia, I think the issue you were experiencing is because instructions that are nested within the purple block occur asynchronously.
More clearly put the instructions within the purple block run on their own,
so. if you were running in a straight line, and you got to a purple block with a “then do” section, your app now take two paths.
- the straight down path. The app will not only do the purple method block but then it will also execute the code immediately below the purple block once it has begun its task.
2. the ‘then do’ path This refers to the “then do” section of the purple method block.
These blocks occur asynchronously. This means that they work on their own time. Another way to think about it is, The app is now executing any code in this section plus what’s below the purple block at the same time.
That said if blocks below the method block require the code from within the method block, and your app moves too quick or the data/computations/code execution takes too long in the asynchronous “then do” section,. In other words, the app code tries to use the results of the ‘then do’ before that data is ready.
Does this make sense?
you could also make something like this. you’d put the blocks in the green box, minus the delay, below the if/'then block in the ‘then do’ section of the realtimeDB Get Call
unfortunately what you suggest me to do was my first choice, which is the first way I tried to create the selection of stores that have a given property. But it does not work. I tried and tried again for three days without getting the result, but what’s worse is that the errors were sometimes different and random, not reproducible. And this is very worrying. Thanks anyway for your help
are you sure that this produces a list of all your tags?
would this do the same?
now that I think of it, @actech has an example of this in his demo app! find that and you will find your answer
Your CreaTagLIST function that you copied from me was a big fat HACK when Thunkable was being buggy.
I know this is a bit late, but I came up with a solution to both propblems: how to access a firebase database and how to extract from a JSON hierarchy.
Notice that loading is a two step process 1) Use the SAVE block to initilize the object on firebase (weird, but necessary). Then you can reference the object using the set block to populate the variable. Now the firebase data is accessible using thunkable VARIABLE blocks. No need to use the Get and save blocks.
You can access the data using the variable blocks, but that doesn’t address how to drill down deep into the hierarchy. The GetProperty function resolves that issue. The KeyPath parameter works just like in MIT App Inventory. Object are specified using the name, and list are accessed using the position (0 is the first position). The GetProperty function works on firebase and local JSON objects.
Thank You for the insights. I tried following them but am not able to get data from Firebase although am able to successfully sent it to firebase. Kindly see the code at
What ever data I save in Firebase, I want to retrieve ALL that data at different times, by clicking on BACK button.
I will be really grateful if any one of you can help.
thank in advance.
To find a problem, display the values of blocks and errors on the screen to identify the block that contains incorrect data.
I took a look at your project.
I was having a little trouble following what you were trying to do with your blocks. I added a few block for the LONG CLICK events that save data to a cloud variable then retrieve it into the list control. I Think that is what you were trying to do.
You might also try getting the screen to work using either APP or STORED variables, then move them to the cloud. That way you can determine if the problem is with the cloud/firebase connection or your other blocks.
I hope that helps.
Thanks a lot for your reply. I did try exactly the way you said, but its not working for me. After long click of the Done as well as Back buttons, nothing happens.
I am able to read data into Firebase from Text_MS1 & Text_MS2 and also able to display data into app from Firebase however I only get the last entry displayed and am not able to display the entire list. PFA the Firebase sample data for reference.