Last active
August 29, 2015 14:20
-
-
Save suddeb/d4cf553e3b07f756f9b9 to your computer and use it in GitHub Desktop.
DistanceOperation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class DistanceOperation { | |
public static void calculateDistance(){ | |
Double myCurrentLocationLatitude = 10.20; | |
Double myCurrentLocationLongitude = 10.20; | |
List<Account> allAccounts = [SELECT ID FROM ACCOUNT WHERE | |
DISTANCE(Head_Office_Location__c, | |
GEOLOCATION(:myCurrentLocationLatitude, :myCurrentLocationLongitude),'mi') < 1]; | |
if(allAccounts.size() > 0){ | |
System.Debug('Total number of accounts: ' + allAccounts.size()); | |
}else{ | |
System.Debug('No Account Found'); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment