Format map icons depending on selection

Hi,
I struggle with some formatting rules.
I have a data table where each record includes a latlong / GPS.
I have a table view to simply lists the records.

Now I would like to select one record in the list to view a map:

  • showing the location of all records applying certain formatting rules
  • apply a different format for the selected record
  • and have another format for all records in a short distance around the selected record (e.g. distance <200m)

In essence I want 3 different formatting in the table - the selected one, the records in a distance near to the selected one and all the others.

Any hint how this could be feasible?

Thanks a lot

Christoph

You would simply need to apply a set of Format Rules to the View Map action being displayed in the Map. Each location type data - address or LatLong columns - will get a View Map action. In the map view when select to display Address, it is actually the associated View Map action that is displayed in the Map itself. As a matter of practice, I normally select both the Address and View Map columns in the same Format rule. I like how it ties the Detail view with the same Icon to the Map pin.

First, the selected record gets its own standard format - a larger red map pin. Unfortunately you will not be able to change that.

You can apply a Format rules to the other pins - one for those where distance < 200 and another for those where distance >= 200

Below is an example of my Customers list, I have residential, commercial and industrial. If you look closely at the dark blue pins there are two different icons by two different rules.

20%20AM

Thanks John,
Do you think this will work with the distance as well? Because the distance shall be the distance to the selected record, so will change every time.
I have already a virtual column, a list of the records where the distance is less then 200m. But I do not know how to use this in the formatting rule.

Oh, right! I do not think AppSheet provides a way to identify the selected record. But, depending on how you select your record you may be able to build your own.

For instance, if you select a row out of a Table view, you could add your own custom Action to the Row Selection behavior that:

  1. Saves that row off as the selected row - maybe update a dedicated simple table with that row id.
  2. Navigate to the map view highlighting your selected row as a pin on the map.

With this concept you could then create your Format rule to compare against the selected row and calculate distance, etc.


On the other hand, if you are selecting pins on a map and are wanting the surrounding pins to change around it, I don’t think it is currently possible to tap into the action of selecting a pin and inject your own custom action(s).

Maybe someone else might have a solution I am not aware of?

Thanks again, John,
your proposal with the update of the simple table pointed to the right direction.
Now I have a solution which fulfills most of my requirements. But to be honest, that is definitely complex to solve and I doubt that I understand the solution in a few month.
I have now added a virtual column with a list of all items in a certain distance.
I added a slice, several views and several actions. Very complex.
I now have to find a solution to remove the entry in the simple table when the view is left.
Thanks again.

1 Like