You need to sign in to do that
Don't have an account?
Ramesh Kalloori
Dynamic SOQL Distance query?
Hi All,
i want pass longitude and latitude values dynamically for the below query.
if i modify the query below iam getting error.
thanks,
RAmesh
i want pass longitude and latitude values dynamically for the below query.
List<Account> Acc=[select Id, Name, BankNameSpace__Location__Latitude__s, BankNameSpace__Location__Longitude__s from Account where DISTANCE(BankNameSpace__Location__c, GEOLOCATION(17.437, 78.453 ), 'mi') < 10 and BankNameSpace__Latitude__c!=null limit 2];
if i modify the query below iam getting error.
Decimal lat=17.437; Decimal lng=78.453; List<Account> Acc=[select Id, Name, BankNameSpace__Location__Latitude__s, BankNameSpace__Location__Longitude__s from Account where DISTANCE(BankNameSpace__Location__c, GEOLOCATION(lat,lng ), 'mi') < 10 and BankNameSpace__Latitude__c!=null limit 2];
thanks,
RAmesh
Alex Tennant
You cannot bind variables that are part of the GEOLOCATION and DISTANCE formulas using the standard colon syntax, however you can use a dynamic SOQL query to do this: