How to Use Power Apps Timer Control + Power Apps Start Timer On Button Click

    In this Power Apps tutorial, We will discuss the Timer control in PowerApps, its properties, and how to add a Timer control in Power Apps.

    As far as we know, Power Apps has various controls for working with canvas apps; apart from that, PowerApps Timer has an interesting control that can be used to execute actions or trigger events at specific intervals or after a certain duration.

    We will also see how to use the PowerApps start timer on button click and how to reset or start the timer control.

    Moreover, I will let you know some more stuff like:

    • PowerApps timer autostart
    • PowerApps timer duration
    • Power Apps timer countdown

    Power Apps Timer Control Or Start Timer in PowerApps

    Microsoft provides timer control in Power Apps to determine how the app will respond after a certain time passes.

    It has a Duration property that tells how long the Power Apps timer will run in milliseconds. The default duration is 60 seconds, and the maximum duration is 24 hours. Look at the image below:

    start timer powerapps

    Power Apps Timer Control Properties

    Next, we will see the key properties of the timer in PowerApps.

    PropertyDescription
    DurationWhen considering the duration of a timer in milliseconds, the maximum allowable time is 24 hours, equivalent to the duration expressed in milliseconds. By default, the timer duration is set to 60 seconds
    OnTimerEndActions to perform upon the completion of a timer’s operation
    RepeatWhether the timer automatically restarts when it finishes running
    AutoPauseThis property can automatically pause the timer control when the user navigates to a different screen
    AutoStartThis property can automatically start the timer control when the user navigates to the screen that contains that control
    OnSelectThese are the actions to be executed when a user taps or clicks on a control.
    OnTimerStartActions to be executed when the timer starts to run
    ResetRefers to the action of a control returning to its default value
    StartYou can clarify whether the time starts
    VisibleWhether a control is visible or hidden

    Add Power Apps Timer Control

    To add a Power Apps timer control, follow the below-mentioned steps. Such as:

    1. On the Power Apps Screen, insert a Timer control [+ Insert -> Input -> Timer].

    powerapps timer start

    2. When you add the Timer control in the Power Apps screen, then it will appear as below. Here, you can see the default Time Duration is 60000 (represented in Milliseconds) or 60 Seconds.

    3. Also, as you can see here, the Repeat and Auto start properties are disabled [Off], but the Auto pause property is enabled [On] by default.

    Have a look at the below screenshot for the output.

    powerapps timer

    Power Apps Start Timer on Button Click

    Using a simple example, I will show you how to start, stop, and reset the Timer control using a Button in the Power Apps.

    Power Apps Start Timer

    On the Power Apps screen, add a Button control (Insert -> Button) and rename it to Start Timer, as shown below. Then, apply the formula below to the button’s OnSelect property.

    OnSelect = UpdateContext({TimerGo: true})

    Where,

    • UpdateContext = It is the function that is used to create a context variable that holds a piece of information temporarily. As in this example, the user is going to select a button a number of times, So this function is used
    • TimerGo: true = TimerGo is the Context variable name, which is specified as true
    power apps start timer

    Now, select the Timer control and apply the below formula on its Start property, as shown below.

    Start = TimerGo
    power apps timer not starting

    When you run the app and hit on the Start Timer button, then you can see the Timer will start as shown in the below screenshot.

    powerapps updatecontext

    Power Apps Stop Timer

    Similarly, add another Button and rename it to Stop Timer. Then apply the below formula on its OnSelect property as:

    OnSelect = UpdateContext({TimerGo:false})

    Where,

    • TimerGo:false = TimerGo is the Context variable name which is specified as false. That means Once you hit the button, the timer will stop
    power apps timer control stop

    Preview or run the app. First, hit the Start Timer button, and the Timer will start. In some cases, it won’t work when you start the timer for the first time. In this case, first Stop the timer and again start it. Then it will work properly.

    NOTE:

    If you start the Timer, do not forget to stop it every time. Otherwise, it won’t work. In this case, when you stop and again start the timer, it will work perfectly
    timer control stop in powerapps

    Power Apps Reset Timer

    To rest the Power Apps timer control, add a Button and rename it Reset Timer. Apply the formula below to the Button’s OnSelect property.

    OnSelect =UpdateContext({Reset: false});
    Reset(tmr_Start);
    UpdateContext({Reset: true})

    Where,

    • Reset: false = Reset is the context variable that specifies the value as false
    • Reset(tmr_Start) = It is the name of the timer control
    • Reset: true = Reset is the context variable that specifies the value as true
    power apps reset timer

    Now, Preview or run the Power apps app. First, Start and stop the Timer button. Then, hit the Reset Timer button. You can see it will work perfectly.

    power apps updatecontext

    Power Apps Timer Autostart

    Next, I will discuss how to work with Power Apps timer autostart with a simple example.

    Example:

    I have created a Power Apps application [Event Feed Back Survey] using a Timer control. Now, I would like to get a timer to autostart during the screen load [every time]. Also, if you want to stop the timer, click on the timer control.

    Have a look at the below screenshot for the output.

    Timer Control Autostart in PowerApps

    To do so, follow the below steps. Such as:

    1. On the Power Apps Screen, select the Timer control and set its AutoStart property is “true“[By default, this property is “false”].

    AutoStart = true
    PowerApps Timer Control Autostart

    2. Once it is done, Save, Publish, Reload, and Preview the app. When the user runs or opens the app, the timer control will be auto started. Once you click on the timer control, the timer will stop.

    This way, we can work with the Power Apps timer autostart.

    timer control duration powerapps

    Power Apps Timer Duration

    In this section, we will see how to work with Power Apps timer duration with a simple scenario.

    Scenario:

    In Power Apps, there are three screens [Welcome Screen, Quiz Screen, and Sucess Screen]. In the Quiz Screen, I added a Timer control to fix the quiz duration.

    When the user opens the screen, it will display a question and multiple-choice options. The candidate must make a decision within 50 seconds. After 50 seconds, it will switch to another screen [Success Screen].

    Output:

    powerapps timer duration

    To work around this, follow the below steps. Such as:

    1. On the Power Apps Screen [Quiz Screen], insert a Timer control and set its Duration property as:

    Duration = 50000
    powerapps timer control duration

    2. Next, set the OnTimerEnd property of the Timer control using the code below.

    OnTimerEnd = Navigate('Success Screen', ScreenTransition.None)

    Where,

    • ‘Success Screen’ = Power Apps 3rd screen name
    power apps timer duration

    3. Once it is done, Preview the app. Once the timer runs out or the duration is over, it will automatically navigate to the other screen shown below:

    power apps timer control duration

    This is how to work with the Power Apps timer control duration.

    Power Apps Timer Countdown

    Suppose the user clicks on the timer. The countdown begins based on the specified duration, and the remaining time will be displayed in the text label control, as shown below.

    powerapps time tracker

    To achieve it, follow the below steps.

    1. On the Power Apps Screen, select the Timer control and set its Duration property.

    Duration = 10000
    timer duration powerapps

    2. Also, set the Timer control’s AutoStart and Repeat properties as ‘true“, as shown below.

    AutoStart = true
    
    Repeat = true
    powerapps pause timer

    3. Now, insert a Text label control and set its Text property to the code below.

    Text = "*Seconds remaing:  " & RoundUp(
        10 - tmr_Start.Value/1000,
        0
    )

    Where,

    • tmr_Start = Power Apps timer control name
    powerapps timer control countdown

    4. Finally, Preview the app. The timer starts automatically, and when the user clicks on the timer control to stop, the text label will display the remaining time [In seconds], as in the screenshot below.

    powerapps time tracker

    I trust you find this article useful. In this tutorial, we discussed how to use Power Apps start timer, PowerApps reset timer, PowerApps timer autostart, and PowerApps start timer with a button with various examples.

    Moreover, you may like some more articles:

    comment_count comments
    Oldest
    Newest
    Oldest

    Comment as a guest:

    >