Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

Find the nearest shop by UK postcode

Like (0) ShareShare
ReportReport
Posted on 2 Nov 2021 12:41:55 by

I have a Sharepoint list of shops with their UK postcodes as a single line of text.  I would like to be able to enter my postcode and find the nearest shop.  I would like to do this using a canvas app.

Categories:
  • AlHal2 Profile Picture
    on 03 Nov 2021 at 11:28:46
    Re: Find the nearest shop by UK postcode

    I was connecting to Bing.  This works now.  Thank you.

  • Verified answer
    Expiscornovus Profile Picture
    31,732 Most Valuable Professional on 03 Nov 2021 at 11:22:10
    Re: Find the nearest shop by UK postcode

    Hi @AlHal2,

     

    Have you made a connection to the BingMaps connector in your app?

     

    connecttobingmaps.png

  • AlHal2 Profile Picture
    on 03 Nov 2021 at 10:14:22
    Re: Find the nearest shop by UK postcode

    Is this right?

     

    AlHal2_0-1635934448803.png

     

  • Expiscornovus Profile Picture
    31,732 Most Valuable Professional on 03 Nov 2021 at 10:09:35
    Re: Find the nearest shop by UK postcode

    Hi @AlHal2,

     

    I see in your screenshot the 'Microsoft Stores' list name and 'Visit Address: Postal Code' field of my dev tenant SharePoint list example are still there. I am assuming I am not that lucky that in your setup it is exactly the same 😁

     

    Can you please update that part of the formula to reflect your SharePoint list setup?

  • AlHal2 Profile Picture
    on 03 Nov 2021 at 09:44:06
    Re: Find the nearest shop by UK postcode

    AlHal2_0-1635932584363.png

    Does this help?  In App On Start I have the following which I can change.

     

    ClearCollect( Shops,
    { Postcode: "NW17FB",Distance:0},
    { Postcode: "SW1A1AA",Distance:0}
    )

  • Expiscornovus Profile Picture
    31,732 Most Valuable Professional on 03 Nov 2021 at 09:39:44
    Re: Find the nearest shop by UK postcode

    Hi @AlHal2,

     

    Can you share some screenshots of your setup (both the canvas app and the SharePoint list) and the formulas with the errors you are getting?

     

    This way we can troubleshoot a bit easier why you are getting invalid arguments errors.

  • AlHal2 Profile Picture
    on 03 Nov 2021 at 09:26:53
    Re: Find the nearest shop by UK postcode

    Powerapps is saying that GetRouteV2 has some invalid arguments and AddColumns has some invalid arguments.

     

  • Expiscornovus Profile Picture
    31,732 Most Valuable Professional on 02 Nov 2021 at 20:53:50
    Re: Find the nearest shop by UK postcode

    Hi @AlHal2,

     

    You could use the Bing Maps connector and use the GetRoute method to retrieve the traveldistance for all your shops. Based on that you can sort on the smallest travel distance.

     

    Below is an example with Microsoft Stores list from SharePoint:

    In this example I am entering a postal code in a text input (in this example the Tower Bridge postal code).

     

    1. In the OnSelect create a new collection DistanceToStores with a new column called distance. The text input is used as waypoint 1, the postal code field from the list item is used as waypoint two.

     

    ClearCollect(DistanceToStores, AddColumns('Microsoft Stores', "Distance", BingMaps.GetRouteV2(TextInput_YourPostcode.Text, 'Visit Address: Postal Code').travelDistance))

     

     

    findcloseststore.png

    2. The gallery is sorted by the new distance column, ascending. The closest shop will be the first in the gallery.

     

    SortByColumns(DistanceToStores, Distance, Ascending)

     

     

    sort_storedistance.png

     

    Hope this helps to get you started?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

🌸 Community Spring Festival 2025 Challenge Winners! 🌸

Congratulations to all our community participants!

Warren Belz – Community Spotlight

We are honored to recognize Warren Belz as our May 2025 Community…

Leaderboard > Power Apps - Building Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 298 Most Valuable Professional

#2
MS.Ragavendar Profile Picture

MS.Ragavendar 174

#3
stampcoin Profile Picture

stampcoin 138

Overall leaderboard
Loading started