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?
Solved! Go to Solution.
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.
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.
@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.
This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.
Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.
User | Count |
---|---|
253 | |
122 | |
84 | |
84 | |
67 |