Showing results for 
Search instead for 
Did you mean: 
Not applicable

BingMaps.GetRoute failed



When I play my PowerApp outside of the studio, I get this error when the app opens. However, the error does not show within the studio. Playing the app outside of the studio, I can still use the app, but the error notification is annoying. A screen on my app is using Bing to calculate the distance between two cities:


Value(Round(BingMaps.GetRoute(StudentGallery_1.Selected.City & ", " & StudentGallery_1.Selected.State, ThisItem.HOME_CITY & ", " & ThisItem.STATE).travelDistance/1.609344,0))


Any idea why the error is showing?

Community Support
Community Support

Hi @Anonymous 


Do you firstly add one BingMap Api connection?


If yes.

Could you please try to change your formula expression as this:

Value(Round(BingMaps.GetRoute(StudentGallery_1.Selected.City & ", " & StudentGallery_1.Selected.State, StudentGallery_1.HOME_CITY & ", " & SStudentGallery_1.Selected.State).travelDistance/1.609344,0))


And I test as the next screenshot shows,it works ok:


My formula expression:

Value(Round((BingMaps.GetRoute(Gallery2.Selected.City& "," &Gallery2.Selected.State, Gallery2.Selected.HomeCity &","& Gallery2.Selected.State).travelDistance/1.609344),0))                    (Galllery2 is my gallery control name on my side)


Hope this could be helpful.


Best Regards.




Not applicable




@v-yuxima-msft Thank you, but my formula is calculating a city and state from my student gallery(StudentGallery_1) against all items within another gallery (Employee gallery); that is why I'm using ThisItem so that the Miles field can display the distance between all items in the gallery against the city/state at the top/left of my graphic.


Not applicable

@v-yuxima-msft The employee gallery is empty when the app opens and its only populated when a user selects a student from the student gallery. The error goes away once the employee gallery is populated and the calculations are correct. I wonder if there's a way to only execute the calculation upon the selection in the student gallery. Not sure.



Hi @Anonymous 


Could you please share more details of your two gallerys?

And what the Button control's formula expression?

I think more details will help  to analyze the issue here.


Best Regards.



Not applicable

@v-yuxima-msft Sure!


The screenshot with the calendar is my Student Gallery, which contains a Hometown field and a State field. The admin user will click the Select Student button to select that student and populate the student's name, hometown, and state. Next, the user will click the Select Employee arrow to navigate to the Employee gallery.





The second screenshot, the Employee Gallery, has a filter where:

Filter(Employee DATA SOURCE,StudentGallery_1.Selected.State = EmployeeState) - Meaning, only display employees in the employee gallery where their State matches the state of the student. 



The Miles label in the Employee Gallery has this formula (the formula is in the label in the gallery's template):

Value(Round(BingMaps.GetRoute(StudentGallery_1.Selected.City & ", " & StudentGallery_1.Selected.State, ThisItem.EmployeeHometown & ", " & ThisItem.EmployeeState).travelDistance/1.609344,0)) - This means that the miles label will display the distance between the selected student's city/state and every employee's city/state in the entire gallery. The user will review the gallery and select the employee with the closest promixity to the student.


The app works perfectly, but the error message displays when you play the app in studio and in a browser.





Frequent Visitor

Hi i have a similar issue(i think), i am using a gallery that is filtered by drop downs, which then provides users with poscodes and a destination (1 input field) . i am calculating distance and duration using the bingmaps.getRoute, however i want the api to only be called when a button is clicked which using the data in the labels of the gallery and also the destination entered in the text input field.

Helpful resources

User Groups Public Preview

Join us for our User Group Public Preview!

Power Apps User Groups are coming! Make sure you’re among the first to know when user groups go live for public preview.

Power Apps Community Call

Monthly Power Apps Community Call

Did you miss the call?? Check out the Power Apps Community Call here!

Power Platform ISV STudio

Power Platform ISV Studio

ISV Studio is the go-to Power Platform destination for ISV’s to monitor & manage applications post-AppSource publish.

Top Solution Authors
Top Kudoed Authors
Users online (64,257)