Retrieve data from Firebase and display in listpicker

Hello everyone, I'm quite new to app inventor and I'm currently stuck on how to retrieve data from Firebase in order to display it in listpicker. I have manually stored the data via Firebase dashboard and the snippet below is the structure of the database. Can anyone guide me on how to proceed with this?

Thank you.
1

Is the seatid a dictionary?

@Alpha2020 No, I did not initialise it to be a dictionary.

Then what?

I initialised it to be a list.

What you want to retrieve

I would like to retrieve the data (T1a, T1d) and display it in a listpicker.

Try This-

Let us say you have your firebase project setup like this and you are using the built-in Firebase component blocks, and your firebase rules are read:true / write:true:

image

To get the data in seatid:

image

image

If you only want to return the items that contain "T1", you can either use the filter bar, or create a sublist from the tag value:

image

image

2 Likes

Your use of numbers as tags is problematic, compared to using the obviously unique seat IDs T1a, T1b, etc. as tags.

I would use this hierarchy for a booking application:

* venue name
  *   seats
    *   "T1a": true
    *   "T1d": true
    *   "T2a": true
...

and for specific events, use

* venue
  * event info
     * event seats
        * "T1a": true
        * "T1d": true
               ...

Beware of the difference in encoding of data structures loaded from AI2 into Firebase compared to data added manually via the Firebase console. Also, AI2's Firebase component has been known to confuse dictionaries with numbers as tags with arrays (lists).
(See post 2 at FAQ Section: Firebase)

1 Like

That is how Firebase does it if you leave it to its own devices....

1 Like