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

Timer resetting itself?

Trying to use a timer with standard Start, Pause, Restart capabilities. Reset is not really important right now, this is a one way ticket.

 

This is in a gallery which might be why it's finicky. I have a column on the gallery source for "started" set to false. I have the timer's start property set to ThisItem.started. I have 2 buttons, one to patch in a "true" to and one to patch in a "false" to the gallery source. Mostly seems to be working. If I hit the button to patch in a "true" the timer starts, if I hit the botton to patch in a "false" the timer pauses, BUT when I hit the button to patch in a "true" again the timer restarts from zero. I need it to pick up where it paused.

 

What's strange is that if I simply use the timer itself as a button it does what I want. Click to start, click to pause, click to keep going. Even though the OnSelect property is set to "false". This ultimately won't work because I need the timer hidden. Any ideas?

1 ACCEPTED SOLUTION

Accepted Solutions

Keep in mind that the Timer's Text property doesn't have to be the Timer's Value.

You were going to have buttons displayed anyways, so maybe just use different Text, and inherently leverage the Timer's functionality by masquerading it as a 'button.'

 

Any other reasons you would hide the Timer?

View solution in original post

7 REPLIES 7
Anonymous
Not applicable

If it's any help to anyone else, it seems to work fine with a toggle switch inside the gallery. So I added a toggle and set the timer's start property to Toggle1.Value

Super User II
Super User II

A potential solution is to use the Timer control as the button itself. Instead of having two buttons, you could have a single 'button' (Timer control) which is contextually updated based on it's 'state.'

  • Initially, the gallery is populated and the started value is false
  • The Timer control is clicked
    • Triggering the timer to begin
    • The OnSelect function could update the started value to be true (or maybe inverted, as below)
      • UpdateIf(colName,ThisItem.id = id,{started: true} OR
      • UpdateIf(colName,ThisItem.id = id,{started: !started}
  • Other functions can run on this initial click
  • When the Timer is clicked again
    • Triggering the timer to pause
    • If necessary, toggle the started value

 

This assumes the Timer control's Start property remains as ThisItem.started. In that case, setting it True initially will start the Timer and allow it to be paused. However, toggling it again may restart the Timer, so consider that.

 

Also, in my testing, looks like the 2nd row toggle to start its Timer results in odd behavior (starts/freezes at other running Timers value). May need to tweak how it's started, or it may be a bug in the Studio.

Anonymous
Not applicable

I'd like to be able to hide the timer. It's really only for background data purposes. I suppose I could set it's visible property to something else. Kinda frustrating this doesn't work.

Keep in mind that the Timer's Text property doesn't have to be the Timer's Value.

You were going to have buttons displayed anyways, so maybe just use different Text, and inherently leverage the Timer's functionality by masquerading it as a 'button.'

 

Any other reasons you would hide the Timer?

View solution in original post

Anonymous
Not applicable

Ooh, I like that idea.

 

I want the button hidden because this is meant to be for work instructions and don't necessarily want operators to feel "on the clock".

Makes sense! Happy coding.

Anonymous
Not applicable

So another interesting kink. Using the timer as it's own button works fine, changing the text property is fine. I wanted to tie the text property to an If(ThisItem.started, "Pause?", "Start") and use the OnSelect property of the timer to change ThisItem.started to !ThisItem.started. No problems there except now the timer "button" won't activate the timer. If I take away the patch function I'm using in the timer's OnSelect then the timer works fine. I'll have to keep messing with it tomorrow.

Helpful resources

Announcements
New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

New Power Super Users

Congratulations!

We are excited to announce the Power Apps Super Users!

Power Apps Community Call

Power Apps Community Call: February

Did you miss the call? Check out the Power Apps Community Call here.

Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

Top Solution Authors
Top Kudoed Authors
Users online (21,792)