cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
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
Highlighted
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
New Ranks and Rank Icons in April

'New Ranks and Rank Icons in April

Read the announcement for more information!

Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

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

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (10,449)