
Hi there,
New to building power apps and have hit a bit of a problem. Hoping someone can help please.
So I have built a power app that takes a text input and then sends that to a power automate flow. Once the flow is finished a different string is returned to the app and displayed. I am using a timer in the power app to reset the app back to its initial settings (i.e. clearing the text box by using: "Reset(TextInput1)") ready for the user to input another string.
The problem is the duration of the timer is hard coded, in my example it is 7 seconds. What I have found is that during different times of the day the time for the data to be sent from the app to power automate, time for the flow to run, and then time for the data to be sent back to the app, varies anywhere from 3-10 seconds.(network congestion I guess?) It is a bit annoying when it takes 6 seconds for example, as then the user only gets to the see the data displayed on the app for 1 second before the reset/clear functions kick in when the timer ends @ 7 seconds.
What I am hoping is that there is a way to start a timer/something equivalent when the data is returned from the power automate flow? and received in the power app? versus what is currently happening to me of the timer starting when I hit the "go" button. For example if the timer "could" start when the data was returned, I could hard code that time to be say 3 seconds. Then it wouldn't matter how long it takes to/from power automate, the data would be displayed always for 3 seconds and then cleared.
Thanks in advance.
Well, after moving onto another area in my app, I stumbled across the answer to this problem!!
If you create a context variable on the app screen and insert this into the formula/function bar: UpdateContext({startTimer1:false});UpdateContext({startTimer1:true}));
I was able to add the above code to my OnSelect "go" button after the code that sends/receives the data from power automate. So in my app I push the go button, data is sent to power automate flow, data is then returned from the flow, then the timer starts, and then once the timer is finished, it clears the app ready for the next run. You also need to change the timer field for "Start" to be the context variable: startTimer1. i.e. so the timer starts when the variable: startTimer1 is true.