web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Find the nearest shop ...
Power Apps
Answered

Find the nearest shop by UK postcode

(0) ShareShare
ReportReport
Posted on 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:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,737 Most Valuable Professional on at

    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?

  • AlHal2 Profile Picture
    on at

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

     

  • Expiscornovus Profile Picture
    33,737 Most Valuable Professional on at

    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 at

    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
    33,737 Most Valuable Professional on at

    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 at

    Is this right?

     

    AlHal2_0-1635934448803.png

     

  • Verified answer
    Expiscornovus Profile Picture
    33,737 Most Valuable Professional on at

    Hi @AlHal2,

     

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

     

    connecttobingmaps.png

  • AlHal2 Profile Picture
    on at

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

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 94

#2
WarrenBelz Profile Picture

WarrenBelz 82 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 38 Super User 2026 Season 1

Last 30 days Overall leaderboard