cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Sort retrieved records based on user's current location

Hello,

 

I am new to PowerApps. My requirement is to sort the retrieved records in ascending order based on the current location of the user.

 

Let say, the user is currently at the location A1 (Latitude=Lat1, Longitude=Lat2).

Now, my requirement is retrieve the list of restaurants (custom entity) in Dynamics CRM with the fields say Address/Latitude-Longutude details.

 

On load of PowerApps, I need to sort the list of retrieved restaurants in ascending order starting from the nearest restaurant from location A1 comes first and the farest restaurant comes last.

 

Please help me achieve the requirement as above.

 

Any help will really be appreciated.

 

Thank you,

 

1 REPLY 1
Community Support Team
Community Support Team

Re: Sort retrieved records based on user's current location

Hi @Anonymous,

 

Personally I think this cannot be achieved. This is because that the earch is a sphere. If it's two-dimensional, then it might be possible to sort with something like:

Sort(Table1,Sqrt(Power((Lat3-Lat1),2)+Power((Lat4-Lat2),2)))

A1 (Latitude=Lat1, Longitude=Lat2)

A2 (Latitude=Lat3, Longitude=Lat4)

 

You could consider to add an idea in PowerApps idea forum here:

https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

 

Regards,

Mona

Community Support Team _ Mona Li
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Power Platform World Tour

Find out where you can attend!

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

SecondImage

Difinity Conference

The largest Power BI, Power Platform, and Data conference in New Zealand

Top Kudoed Authors (Last 30 Days)
Users online (3,963)