Why can't I access nested database information?

I have the following database of Firebase, under ‘c’ the user IDs are listed and for every user, I need to count the total occurence of 0’s or 1’s for the ‘route’ key.

With the following blocks, I have the userIDs stored in a list called driverList. I want to make another list with all the route values so I can count occurences of 1’s and 0’s but my for loop can’t append the route values into the driverListRoute list. Where could the problem be? Thank you so much.

JyWNjBg

That looks right to me. Have you tested the Firebase connection to make sure you can get any data from Firebase with your current console rules?

A simple test would be to set a label’s text to cloud variable “c/DDsSX536mjYBmWn4zZm1T2qW0252/route” and make sure that “0” is displayed.

Also, are you initializing app variable driverListRoute to an empty list?

1 Like

Thank you I set the variable to null, didn’t know I needed to initialize it is an empty list. Solved my problem!

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.