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.

 

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
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

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