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

Handling of Bingmap error

Hi all,

I have 2 fields namely vendor address and destination that take in text inputs from the user.

The distance and duration fields as seen below have bingmaps formula that calculate distance and duration. While the form works, users will see popups of bingmaps error as they are keying the address and destination fields. The reason is bingmaps is constantly evaluating the formula before the user completes the address and destination fields. 

Is there a way to prevent the errors from popping up? 

Alois_1-1605689312354.png
Regards,
Alois

 

7 REPLIES 7
Community Support
Community Support

Hi @Alois :

I have a solution.The point is using variable and the Onchange property.

1\Set the textinput box's OnChange property to

Set(thevar,TheTextInputControl.Text) /*thevar is my custom variable*/

2\Use thevar as the parameter when you use BingMap

99.gif

In this solution, a variable is used as a buffer between the textinput control and the Bingmap module.
Only when the user completes all input will the OnChange event be triggered, and then the value of this variable will change.
This can effectively avoid the Bingmap module always evaluating the value of textinput when the user is typing.

Best Regards,

Bof

 

Hi @v-bofeng-msft ,

That's really some cool stuff. 🙂

However, the error still persist.

Alois_0-1605768459344.png


I suspect it's because bingmaps is constantly evaluating the distance and duration even before the variables are created. Meaning to say, bingmaps formula are active upon visibility of the screen. Maybe the solution requires the distance and duration formula to be disabled until the variables are created.

Regards,
Alois

Hi @Alois :

I suggest you set a default value for these variables through the OnStart property, so that you can ensure that there is no error.

Best Regards,

Bof

Hi @v-bofeng-msft ,

I have done so as seen below. The error persist.

Alois_0-1605778611563.png



Regards,
Alois

Hi @Alois :

Sorry, I might not be clear just now.

What I mean is that you can directly hardcode thevar and thevar1 values.For example,set the OnStart property to:

Set(varUser,User());
Set(thevar,"DefaultText");
Set(thevar1,"DefaultText")

The key is to use a string that will not cause an error as the default value of thevar and thevar1.

In addition, you can also use

If(
   IsBlank(DataCardValue51.Text),
   0,
   XXXX /*XXXX refers to your original formula*/
) 

where the error is reported to avoid the situation where the textinput key value is empty

Best Regards,

Bof

 

Hi @v-bofeng-msft 

Hardcoding won't work as the nature of the destination and address fields are not fixed.

The issue still persist. I guess I'll look to changing my workflow. 

Regards,
Alois

Hi @Alois :

I suggest that you can modify your formula in this way:

First determine whether the value of DataCardValue51/52.Text is empty

  • If the value of DataCardValue51/52.Text is empty, the default value is displayed
  • If the value of DataCardValue51/52.Text is not empty, call BingMap

This can avoid causing errors when the value of the variable is empty or the value of DataCardValue51.Text is empty.The fromula:

If(
   IsBlank(DataCardValue51.Text),
   0,
   callBingMap /*callBingMap refers to your original formula*/
) 

Best Regards,

Bof

Helpful resources

Announcements
secondImage

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Power Apps Community Call

Power Apps Community Call: February

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

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

Top Solution Authors
Top Kudoed Authors
Users online (91,570)