How to get get values from objects with a dynamic key?

Hi everyone, I’m having some trouble understanding how to create a list from values stored in my Firebase Realtime dB. I’ve created branches within my dB where each branch has a key/property named “spot”. My problem is that when I try to run a Get Command, I’m not sure how to reach my desired values. Is it possible to cycle through a bunch of keys, for example “reservation_0, reservation_1, reservation_2,…etc” so that I can make a list from the “spot” value of each of these? I’ll upload pictures to better explain.

One alternative I was going to look into for this setup was to create a second dB within firebase so that the “spots” could be the only thing in the dB. But I’m hoping that that won’t be necessary. I also looked into using cloud firestore for a different way to query the database but I admit I’m new to some of the backend workflows.

To obtain the key value dynamically, you need to create an appropriate algorithm using text blocks and blocks for working with lists.

I’m familiar with doing that in Javascript, but I’m having trouble figuring this out in Thunkable. I’ve also tried reconfiguring my dB so that my key would be static, but then the “spot” value keeps getting overwritten.

So I have to have a dynamic key and I’m keeping it simple by just numbering them incrementally. I’ve built an algorithm to dynamically name the keys as new reservations are created. I’ll post a picture of that later today. My problem now is doing a GET method to pull these values. Any advice on how to structure the algorithm?

The scrJSON and scrFirebase screens give examples of manually obtaining the value.

1 Like

Thank you. I’ll give that a try this evening and let you know my results.