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?
Regards,
Alois
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
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.
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 @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
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
User | Count |
---|---|
239 | |
116 | |
94 | |
58 | |
32 |
User | Count |
---|---|
287 | |
132 | |
106 | |
63 | |
59 |