How to compare and get the values as per requirement from the list saved in the database

I am trying to make an app where you can find a buddy to play by searching with zip code and interest. So that, children of near by area with similar interest gets displayed in the form of a list. I am unable to understand how to do it. Below mentioned is the structure of my database in which it is saved.


1 Like

I would use Firebases firestore geoquery capabilities via the web api connector (advanced) or a service like xano

You could also look into saving locations as coordinates and using a Haversine formula to find proximal points of interest.


From your data structure, you are saving the children’s data under a key which is the zip code. if this assumption is correct then you can get the zip code keys as a list by using
get object properties block. Once you have it as a list then use does list .... contain .... to shortlist only the zip code of the logged in child. From here you search the names under the selected zip code the same way you did previously.

1 Like

I tried the same with the below mentioned block but not getting the zip code. This code gives me answer as “User, Children_info, User, Children_info” , User. I am unable to skip user folder and go to zipcode which is inside Children_info.

1 Like

First of all, to retrieve all data in the database use // not just one.

Second, if you use this then the get object properties will show the first available key which is in this case the user ID.

I would prefer to do it this way

For testing, I would show it in a List Viewer so I know it works and I can see what data is being presented.

For you, you should see a list of internet code of the user ID

Sample output

1 Like

With your suggestion I tried this code and started getting the zip code.
But if I ask the user to input the zipcode, I get nothing.

This is the main input asked by the user.

1 Like

remember this is an EXACT match. So if the user enters: 7760 and you are storing in the database 07760 then it fails to match.

1 Like

I am filling 7760 only not 07760. Moreover, what code should I use two get the name of the children as per the zipcode and interest entered by the user. I am unable to get the logic for that.

1 Like

I’m not sure. I only saw part of your data. To answer, I need to see your data. Go to Firebase, open your Realtime DB and use the right side menu to export your data to a file then share it here if you think the data is not private or send it to me as a PM.

I need to see the full structure to be able to give you a meaningful answer.

1 Like

PM sent. Thanks for your help.

1 Like

I replied to your PM. Please review and let me know.

[By the way]
Putting white spaces in the end of the key could make it difficult even for you to figure out why it does not work.

The key Children_Info has a space in the end of it. It took me a while to find it.

For others to take benefit of the coding, this is what I made in the Screen Opens block

This extracts two lists from the data structure:

  • Zip code list
  • Interest list

See a sample output

1 Like

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