Make function the search a database for useable geolocations with a while test block

I want to make a button clicked function that searches my database for geolocations within range. I have tried with a while test, but it doesnt return locations. Does anyone have a good idea?

Don't use a while test. Just search you list.

If there were Nomenclature Police, they would be arresting you for abuse of variable and component names.

How can you work like that, without naming your variables to identify their purpose?

1 Like

To make the nomenclature police confused. They hate when you do it like this :wink:

You need to do more than just provide your data List. You need to calculate the range to each of the locations. Then determine whether a location is within your range limits.

That means you need to provide a List of coordinates; calculate the range from your current location perhaps, then construct a new List ranked greatest to shorter distance; then provide a subList of those coordinates within the range. What you propose for Button26 will never work. :cry:

I want to use the while test function because i want the firebase db to be dynamic. I dont want to be limited to a certain number in my db. It must be possible to make a loop to check the geolocations in the algorith. It will be very har to change the list numbers all the time if the list is dynamic.

If you need to do something cyclically, use a clock component.

In the firebase components there is a get tag list. Is it possible to retrieve the tag list from the fire db on initializing the screen. Then make a got tag and make a variable list with the tags. Then use the tag list to check the geo locations shown in the got value block?

That sounds about right.
Get to it.

Use the length of list block

I have made a test where i have tried to make an initial retrieval of tags. Then the tagslist is added to the got value. However the tagslist cannot be entered in the got value function. How do i download a tagslist and retrieve the data from alle the tags? The list is dynamic? I dont understand how you would use list lenght?

Can you get a list of all the geo locations from database to app? If yes, you can filter them on your app.

What's your data structure in Firebase?

I have allready downloaded the data incl geolocations to my app. The database structure is shown underneath. It is made by the way data transferred to the database i shown. I will be uploading most data from the database console. However i get a error message ( The operation select list item cannot accept the arguments: , ["["], [1] Note: You will not see another error reported for 5 seconds.) It passes the data as requested.
I think it has to do with the "" in the beginning and the end og the data.

data1:""["55.06130, 14.699593","Rønne apotek"]""

data12:""["54.659856, 11.355014","Rødby Krone Apotek"]""editdelete

data13:""["55.859130, 9.852076","Horsens Svane Apotek"]""

data15:"["57.0333441,9.9075633","Skipperen apotek"]"

data2:""["55.277124, 14.802248","Allinge apotek"]""

data3:""["55.063268, 15.133700","Nexø apotek]""

data4:""["57.042371, 9.919039","j.f. kennedys plads apotek"]""

how did you get this data? from result of DO IT? or you copy from firebase console ?

this is still in the sea....:wink:

I agree it is a good thing that even the fish gets drugs :slight_smile:

It is worse that my distance calculator algorithm is behaving badly again. The right number do come in but the result is way off.
I have tested the location sensor is in degrees and so are the decimal degrees from the apotek in the sea. I just cant see what i do wrong.

I took it from the console, but i have tested the retrieval of data by visualising it in labels. For some reason i cant make do it work.

we need to see the real data you get, not from firebase console.

Hallo everyone
Here is the final of my project. I download a taglist and filter the value of geolocation through at firebase db to find the locations within 30 km from the user. I visualize it in a listview in the end. Thanks for the help along the way.

Adjust your formula to this:

returns distance in metres