How to filter model by distance

  • 6
  • Idea
  • Updated 4 years ago
  • Implemented
Is it possible to create a filter condition that limits records based on distance. For example if have a custom Geocode field on Contact named Location__c I would like the filter to result in a SOQL query like

SELECT Id FROM Contact WHERE DISTANCE(Location__c, GEOLOCATION(latitude,longitude), 'mi') < miles

Ideally I would also like the values for latitude, longitude and miles be fitlerable. I'd like to combine this so that geocoordinates from my position or clicking a certain position on a map limits the model results.
Photo of Peter Baeza

Peter Baeza

  • 2,868 Points 2k badge 2x thumb

Posted 5 years ago

  • 6
Photo of Zach McElrath

Zach McElrath, Employee

  • 52,276 Points 50k badge 2x thumb
Official Response
The ability to perform Distance / Radius search based on Geolocation / Address fields has been added with Skuid Banzai! When you add a Condition to a Geolocation or Address type field, the SOQL DISTANCE() function will automatically be applied to the field, and you'll see new options for determining the source of the value to use for the kilometer / mile radius value.