I don't agree. The National Park tutorial uses a different method of determining nearest than I recommended and does not have a method to 'erase' previously set Runtime Markers. The example I posted removes previously set Runtime Markers. You are welcome to experiment with the NP example as you want. Instead of Runtime Markers you probably would do better using lots of Designtime Markers as a mentioned earlier.
The spreadsheet you posted won't work with NP or my example.
The sheet must only contain the most recent coordinates of the drivers . Your current spreadsheet shows every instance of an updated driver's location without replacing the previous location. You want to identify ONLY the most recent locations for the marker. You need to eliminate all the items with a red X. I don't know how you would do that. Your code should have a way restrict the content to ONLY the most recent for each driver. ONLY the green highlighted entries are valid. You need to fix that.
also, your spreadsheet has
a time/date, name, number, latitude,longitude and does not have an item for DISTANCE
2.1,01088,Mustafa,11111111,31.44598,31.67974
1.3,01098,Ali etc.
etc.
while the example uses
2.1,1,Mustafa,11111111,31.44598,31.67974 (it does not have an item for time/date )
1.3,2,Ahmed etc.
etc.
It appears you have done a lot of work. You are still copying code instead of understanding the code unfortunately. Attempting to get everything to work in one step makes your attempts at coding confusing by providing a lot of code that does not work. Seldom does that strategy work.
i listened to your advice and tried your aia file, i just replaced the file with the sheet, just lets make a view and let me know what can i do to make it read same as the file driverSelectionExample8.aia (17.5 KB)
I added an H column so that each user has a value of 0\n. When you do this it allows converting the spreadsheet values to a csv Table. (Mustafadata.csv).
Mustafadata.csv (267 Bytes)
Column H can be used for time. I used the 0\n to get the data that your Web_import added to the original csv. All entries need it but the last entry must not have the \n . The link you provided worked to capture Hassan once, then when I returned to the docs.google document, Hassan was no longer there. I guess you are modifying the document See Mustafadata.csv where I showed how I think the csv should look. When you add an new time with a more recent time, you should not add the driver as a new item, you should REPLACE the previous position.
I load the csv file from an asset. That means you will have to store the modified version in the app's private storage ASD app specific instead. I don't show how to do that. (Asset: Files are read from the app assets. It is an error to write to app assets as they are contained in read-only storage.)
you are trying to enter each driver with a sequential id number. Doing that complicates the coding. Instead I suggest everyone gets a permanent id perhaps.
The csv Table is named as fullDriverCSV in the File1.GotText block.
Create the fullDriverList in Button3 and by assigning fullDriverList to list from scv table text fullDriverCSV (see the Button3 code) . This lets you use what is now a List to calculate the nearest driver
run the example. First press the get Spreadsheet contents button to load the csv. Then use the Find nearest driver Sort destinations button. Then you can Post All Drivers Locations. to see where all the drivers are. When you sort, Ahmed becomes the nearest to my location (because I use the LocationSensor to set the customer and I have to use my gps location with the LS to provide an example).
Hope this jumbled discussion helps you fine a way forward.
unfortunately, you made it more hard to me, All my trying is to make the location updated from the google sheet but you back it again to a file which i cant make it works with updated locations, i will try another ways anyway thanks for your response
o avoid using a csv solution you have to download the sheet as a ListOfLists. instead of as a csv as you did ( iz/tq?tqx=out:csv&range=A2:G200&tq=SELECT ] ) or store the customers as a ListOfLists using Firebase.. Can you do that? Sorry, I don't know how.