Displaying Data in the ListView
The next step in the making of your app is creating a way to see all the accessbile places. You want to program it so that it finds all the place entries and then adds each one as an element of the ListView in the ListOfPlaces screen. To do this, you are to need the FirebaseDB component again.
-
Switch to the ListOfPlaces screen and drag out a FirebaseDB component onto the Designer view.
-
Now switch over to the Blocks view, and take out a
when ListOfPlaces.Initializeblock. Everything in this will run as soon as this screen opens up. -
Place a
call FireBase.GetTagListblock inside this block. This tells Firebase to return a list containing the tags of all saved data in your database.

- Take out a
when FireBase.TagListblock and insert afor each item in listblock inside it. This function will run as soon as Firebase gets our collection of tags in the form of a list, which it uses as thevaluevariable.
With the for loop you now have individual tags being set to the item variable. Of course you don’t want the tag, you want the address, and you’ll use the tag to get it.
Grab a call Firebase.GetValue block, and set the tag to the item variable, since this contains the current tag from the value list.

-
Add a
when Firebase.GotValueblock, and put aadd items to listblock inside it. -
You will need a list to add locations to, so add an
initialize global nameblock. Change itsnametolocationsand drag acreate empty listblock onto the end of it. -
Now attach a
get global locationsblock to the list attachment of theadd items to listblock, and aget valueblock to the item attachment. Thevaluevariable contains the address of the place.
Note: the list of tags will also contain the "PlaceNumber" tag that you’re using to keep count of the places, so you’ll need to exclude that from the list you display.
-
Add an
if thenblock from Control to yourGotValueblock, and move theadd items to listcode so it’s inside thethenblock. -
Onto the
ifpart: attach anotand an=from Logic. Hover over thetagvariable and put aget tagon the left of the=. tThen put a""Text block on the right and type"PlaceNumber"into it.

- Lastly you need to tell the ListView to get its elements from your list. Get a
set ListView.Elementsblock and attach aget global locationsblock to it.
