cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MSC01
Helper I
Helper I

Bingmaps. GetRoute using a button for gallery

Hi i am using a gallery that is filtered by a dropdown where users can select certain options. The gallery retrieves a list of users that match the option selected in the drop down. Each user has a label of their postcode, i have also used labels that contain bingmaps.getRoute that calculate distance and another for duration. The destination is entered via a input text box and each user has their own label for distance and duration from their own post code to their destination label (which is the same as it uses the address entered in the input box). i wanted to know how do i only get the gallery to use the api when a button is clicked and it uses the updated value entered in the input box. Need to keep in mind that when the app starts the input box can be blank.

1 ACCEPTED SOLUTION

Accepted Solutions
v-xiaochen-msft
Community Support
Community Support

Hi @MSC01 ,

 

Could you tell me:

Do you want the distance to be updated only after the user enters a value in the textinput control and presses the button?

 

If my assumptions are correct, please use a variable.

 

I did a test for you:

1\ Add a textinput control 'TextInput1' 

 

2\ Add a button control and set its OnSelect property to:

Set(Thevar,TextInput1.Text)

 

3\ Add a label and set its Text property to:

BingMaps.GetRoute("Seattle",Thevar).travelDistance

 

4\ The result is as follows:

AAA.gif

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

View solution in original post

2 REPLIES 2
v-xiaochen-msft
Community Support
Community Support

Hi @MSC01 ,

 

Could you tell me:

Do you want the distance to be updated only after the user enters a value in the textinput control and presses the button?

 

If my assumptions are correct, please use a variable.

 

I did a test for you:

1\ Add a textinput control 'TextInput1' 

 

2\ Add a button control and set its OnSelect property to:

Set(Thevar,TextInput1.Text)

 

3\ Add a label and set its Text property to:

BingMaps.GetRoute("Seattle",Thevar).travelDistance

 

4\ The result is as follows:

AAA.gif

Best Regards,
Wearsky
If my post helps, then please consider Accept it as the solution to help others. Thanks.

View solution in original post

MSC01
Helper I
Helper I

Thanks for posting this solution, i managed to get there in the end. I had another question, the gallery is linked to CDS and the fields used are from this source e.g name and postcode. I have included the label for distance and duration into the gallery using the bingmaps.getRoute - is there any way to order by duration label if the gallery is filtered by a drop down where i am using name in 

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (2,967)