cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Khalid_al_bahsh
Level: Powered On

Sort Gallery Contacts by Location

I need a gallery that shows me all my customers that are near me. So I can see who is near me to pay them a visit and sell them our product

 

is that possible??

 

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: Sort Gallery Contacts by Location

Hi @Khalid_al_bahsh ,

Firstly, you could use Location function to get your own location value.

Here's a doc about location function:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/signals

Secondly, connect with Bing Map connetor.

Try to use BingMaps.GetLocationByAddress function to get every customer's location value.

Here's a doc about  BingMaps.GetLocationByAddress function:

https://docs.microsoft.com/en-us/connectors/bingmaps/#get-location-by-address

Then, insert a label to display the distance between the two location.

Try this formula:

ACOS(Cos(Radians(90-Location.Latitude))*Cos(Radians(90-ThisItem.Latitude))+Sin(Radians(90-Location.Latitude))*Sin(Radians(90-ThisItem.Latitude))*Cos(Radians(Location.Longitude-ThisItem.Longitude)))*6371

 Then, you could sort the gallery according to the value of the label.

 

Here's a similar issue for your reference:

https://powerusers.microsoft.com/t5/General-Discussion/Sort-gallery-by-closest-location-after-search...

 

Best regards,

Community Support Team _ Phoebe Liu

 

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

View solution in original post

2 REPLIES 2
Khalid_al_bahsh
Level: Powered On

Re: Sort Gallery Contacts by Location

using the location of the device being used

Community Support Team
Community Support Team

Re: Sort Gallery Contacts by Location

Hi @Khalid_al_bahsh ,

Firstly, you could use Location function to get your own location value.

Here's a doc about location function:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/signals

Secondly, connect with Bing Map connetor.

Try to use BingMaps.GetLocationByAddress function to get every customer's location value.

Here's a doc about  BingMaps.GetLocationByAddress function:

https://docs.microsoft.com/en-us/connectors/bingmaps/#get-location-by-address

Then, insert a label to display the distance between the two location.

Try this formula:

ACOS(Cos(Radians(90-Location.Latitude))*Cos(Radians(90-ThisItem.Latitude))+Sin(Radians(90-Location.Latitude))*Sin(Radians(90-ThisItem.Latitude))*Cos(Radians(Location.Longitude-ThisItem.Longitude)))*6371

 Then, you could sort the gallery according to the value of the label.

 

Here's a similar issue for your reference:

https://powerusers.microsoft.com/t5/General-Discussion/Sort-gallery-by-closest-location-after-search...

 

Best regards,

Community Support Team _ Phoebe Liu

 

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

View solution in original post

Helpful resources

Announcements
thirdimage

Power Apps Super User Class of 2020

Check it out!

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 Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (5,132)