cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
jw2
Frequent Visitor

Timer set to zero

I have a main page with button that clicks through to a sub-page.

 

The sub-page has a Form on it. The sub-page stays open until the form is submitted, then a Timer starts for 30 seconds. OnTimerEnd the timer navigates back to the main page.

 

If the user enters the form again during those 30 seconds I need the Timer to reset back to the beginning, so the user gets another 30 seconds on the sub-page.

 

I've tried a number of things but cannot get the timer to reset back to zero. At the moment for the Form submission I check OnSuccess:

 

UpdateContext({StartTimer3: false});

Timer3.Value=0;

UpdateContext({StartTimer3: true});

ResetForm(Form1)

 

(Timer3 Data is set to StartTimer3)

 

The initial form submission correctly starts the timer, but any further form submission doesn't reset the timer, so when it reaches 30 seconds the page navigates away back to the main page.

 

What am I doing wrong?

3 REPLIES 3
pathomson
Advocate II
Advocate II

I think you need to update the context of the timer to false at the end of your statement (when it is completed the execution), or on the navigation away from the form.

Shanescows
Super User
Super User

I am not following exactly what you are trying to do but I will give you some ideas that I think are the pieces you are missing. 

 

  • You need to reset your timer if they navigate back to the page. For your time set the Reset property to a variable named ResetTimer. Have the screen on visible run UpdateContext({TimerReset: true});UpdateContext({TimerReset: false})
    • This will reset the timer everytime the page loads

Actually, I think that is all you are missing. 🙂 Let me know if you need more help. I have videos on using the Timer Control and animations (which showcases Timer)

Shane - Microsoft MVP, YouTube, and PowerApps Consulting for when you are in a bind to get this fixed quickly. And finally we now have PowerApps Training
v-xida-msft
Community Support
Community Support

Hi @jw2,

 

I have made a test on my side, please take a try with the following workaround:9.JPG

 

The OnVisible property of the Sub-page screen set to following formula:

UpdateContext({IsReset:false});UpdateContext({IsStart:false})

The Duration property of the Timer control set to following formula:

30000

The OnTimeEnd property of the Timer control set to following formula:

Navigate(Screen1,ScreenTransition.Fade)

The Reset property of the Timer control set to following formula:

IsReset

The AutoStart property of the Timer control set to following formula:

IsStart

 

The OnSuccess property of the Form (Edit Form) set to following formula:

UpdateContext({IsReset:true});
UpdateContext({IsStart:true});
ResetForm(Form1);
UpdateContext({IsReset:false});
UpdateContext({IsStart:false})

 

Best regards,

Kris

 

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Solution Authors
Top Kudoed Authors
Users online (1,865)