cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
pedromoreno
Level: Powered On

How to start and stop a timer control using a button ?

How to start and stop a timer control using a button ? TY

1 ACCEPTED SOLUTION

Accepted Solutions
PowerApps Staff carlosag
PowerApps Staff

Re: How to start and stop a timer control using a button ?

What I do is use a context variable and assign that to the "Start" property of the timer.

So for example, add this to the OnSelect of your button

	UpdateContext({StartTimer: false});UpdateContext({StartTimer: true})

 

and then set the Timer.Start to just "StartTimer"

 

 

20 REPLIES 20
PowerApps Staff carlosag
PowerApps Staff

Re: How to start and stop a timer control using a button ?

What I do is use a context variable and assign that to the "Start" property of the timer.

So for example, add this to the OnSelect of your button

	UpdateContext({StartTimer: false});UpdateContext({StartTimer: true})

 

and then set the Timer.Start to just "StartTimer"

 

 

grunwald
Level: Powered On

Re: How to start and stop a timer control using a button ?

Hi everyone,

 

i want to add something to this Topic. The Solution by carlosag works fine, thank you!

BUT if you have autostart of your timer as true be aware, because the autostart option seems to overrule the start option.

 

hth.

 

 

 

Highlighted
mkeller
Level: Powered On

Re: How to start and stop a timer control using a button ?

@carlosag I'm not sure what changed but your formula doesn't seem to work quite right:

 

UpdateContext({StartTimer: false});UpdateContext({StartTimer: true})

 

That formula, when added to my OnSelect of my button, only starts the timer and won't stop it. If i create two buttons and separate the UpdateContext formulas, it works great. But not as a single formula for a single button. Is there a way to do this? I want the button to toggle the timer on and off, not have to have two separate buttons. 

 

Thanks! 

Prem_ddsl
Level: Powered On

Re: How to start and stop a timer control using a button ?

To toggle using one button try:

UpdateContext({StartTimer: !StartTime})

rgparisoto
Level: Powered On

Re: How to start and stop a timer control using a button ?

Great! Very good!

Thank you.

Super User
Super User

Re: How to start and stop a timer control using a button ?

Nobody seemed to mention it doesnt work at all with your editor in "edit" mode.  If you dont play, it no workie.  Another wasted hour.

JeremyDIV
Level: Powered On

Re: How to start and stop a timer control using a button ?

I have never worked with a platform as inconsistent as this and with so many gotchas. Your Message was the only thing that stopped me from pulling out the last few hairs on my head. Before PowerApps I had hair like a yeti.

Super User
Super User

Re: How to start and stop a timer control using a button ?

@JeremyDIV

 

Same here.  As well as the endless syntax variations that make intuition virtually worthless in many cases.  Strangely, other things are remarkably simple.  The overall average is better, however, than learning to be a programmer to use things much more lower level like "C", etc.

JamesM
Level 8

Re: How to start and stop a timer control using a button ?

I have never worked with a platform as inconsistent as this and with so many gotchas.

You mustn't have worked with many platforms then. PowerApps is incredibly powerful and has a very simple, fundamentally logical workflow with very few things that aren't plainly obvious within the editor and the syntax. And that's coming from a full stack C# developer. I have chosen PowerApps on several occasions because of the rapid speed you can smash out a great user interface or presentation layer app, then power the guts with MS Flow / serverless functions or a decent web API. 

Helpful resources

Announcements
firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, September 18th at 8am PDT

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Users Online
Currently online: 57 members 4,415 guests
Please welcome our newest community members: