cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Timer Control Powerapps

Hi All,

i have a timer control which allows it to function on a start and a stop button. 
Start button basically starts the timer and stop button saves the timer value in hh:mm:ss in a sharepoint field and resets the timer.

here is the code below for it.

UpdateContext({timer: Text(Time(0, 0, Timer1.Value/1000), "[$-en-US]hh:mm:ss")});

 Now, the requirement is that every time the timer is started and stopped it should append to its previous value. 

so if my timer duration field has value of 00:00:05 seconds and i turned the timer on and off again and it captured 00:00:10 seconds the total time in the field should be 00:00:15 seconds. 
which means i basically want to add previous and current value and store it in the field, how do i do that?

1 ACCEPTED SOLUTION

Accepted Solutions
WarrenBelz
Super User
Super User

Hi @Anonymous ,

Firstly you need to get rid of the Text as you cannot add anything to it.

Initiate a Variable - you can do this when you start the timer - call it whatever you want

UpdateContext({vTimer:0})

Timer stops

UpdateContext({vTimer: vTimer+Timer1.Value})

each time it will add to the value stored there

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

View solution in original post

4 REPLIES 4
WarrenBelz
Super User
Super User

Hi @Anonymous ,

Firstly you need to get rid of the Text as you cannot add anything to it.

Initiate a Variable - you can do this when you start the timer - call it whatever you want

UpdateContext({vTimer:0})

Timer stops

UpdateContext({vTimer: vTimer+Timer1.Value})

each time it will add to the value stored there

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

View solution in original post

Anonymous
Not applicable

@WarrenBelz i tried your approach and it worked fine, however the below code sets the variable value to 0 and thus it looses the value stored before. i have just used to addition code and it worked fine.

UpdateContext({vTimer:0})

 

Hi@Anonymous ,

You only use that code once a the start (I thought I had said that in my post) - it simply initiates the Variable.

The other code will then do what you need.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

 

 

Hi @Anonymous ,

Just checking if you got the result you were looking for on this thread. Happy to help further if not.

 

Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

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 (2,306)