Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QueryFactory addOrdering - Support for Distance #141

Open
tmowbrey opened this issue Oct 30, 2016 · 3 comments
Open

QueryFactory addOrdering - Support for Distance #141

tmowbrey opened this issue Oct 30, 2016 · 3 comments

Comments

@tmowbrey
Copy link
Contributor

At this time, it appears I have no way of creating a query that does the following:

SELECT Id, Name, MailingLatitude, MailingLongitude
FROM Contact
ORDER BY DISTANCE(MailingAddress, GEOLOCATION(40.7657, -73.9899), 'mi') ASC

Because DISTANCE is not a field, there is no way to call addOrdering to support the above. If this is possible, can someone help me out? If not, I'd like to propose an enhancement.

Thanks!

@o-lexi
Copy link

o-lexi commented Nov 10, 2016

@tmowbrey Create a formula field if you are going to use the same geolcation coordinates

@tmowbrey
Copy link
Contributor Author

That's easy enough when managing your own org, but I'm using this for a managed package where I don't know the object that I'm querying before hand. I'm asking the end user to provide the compound address or geolocation fields as part of setup. I'd prefer that we determine if we can add an additional method to support distance and geolocation adds to the query factory, if possible.

@dfruddffdc
Copy link
Contributor

So we want a generic enhancement to support soql functions in select/where/order by clauses. Sounds useful to me.
Marked as an enhancement request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants