function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kush Patel 5Kush Patel 5 

GEOLOCATION on SOQL

Has anyone tried to use their field variable as the center of the distance? PLEASE GET BACK TO ME ASAP
public class kushgeocode {

    public List<Account> acct {get; set;}
    //public Integer radius {get; set;}
    public Decimal myLatitude {get; set;}
    public Decimal myLongitude{get; set;}
     
   
    public kushgeocode(ApexPages.StandardController controller) {
    
       
     
 
  
     myLatitude =  40.6423077;
     myLongitude = -74.5680403;              
     acct = [SELECT 
                  Name, 
                  Geocodes__Latitude__s, 
                  Geocodes__longitude__s, 
                  BillingStreet, 
                  BillingCity, 
                  BillingState
             FROM 
                  Account
             WHERE DISTANCE(Geocodes__c, GEOLOCATION(:myLatitude,:myLongitude), 'mi') < :1000];
              
                                                                                     /*^^^Change 10 to :xxxxx*/

        
    }    
     
        
           

    }
Kush Patel 5Kush Patel 5
Basically replace myLatitude and myLongitude with the Location__c value of each individual account