web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Suggestions for the timer
Power Apps
Unanswered

Suggestions for the timer

(0) ShareShare
ReportReport
Posted on by 83

Guys, I would like some help regarding the timer and what forms or alternatives can I use to start a timer from the moment an item is registered in the SharePoint form.

I've already tested the timer in the galleries with collections and forms in Sharepoint, but it's giving a bug in Power Apps (check the image below) 

 

MayranPiran_0-1674482860726.gif

 

 

To understand the process:
Every time an employee creates an item in the form, this item needs to have a timer and this timer every time it passes two hours, the employee needs to receive any type of different notification/coloring, making it visually explicit for the employee to justify the reason for having exceeded these two hours.

Sorry for the large text, I count on your help

Categories:
  • bobesponja Profile Picture
    258 on at

    To reduce the number of controls, you can just have a single timer outside of this gallery that regularly runs Refresh(YourDateSource) in the OnTimerEnd event. If you use this approach, you only need a label on each gallery item with code like this:

     

    With({secs: DateDiff(ThisItem.DateTimeCreated,Now(),Seconds)},Text(RoundDown(secs/3600,0),"00")&":"&Text(RoundDown(secs/60,0),"00")&":"&Text(Mod(secs,60),"00"))

     Of course, if your gallery items are referencing a collection instead of directly referencing the SharePoint list, you'll want to ClearCollect after you Refresh to catch any changes.

  • MayranPiran Profile Picture
    83 on at

    Hi,

    @bobesponja 

     

    Sorry for the delay to reply...

    I didn't quite understand how I should run this code you reported

     

    MayranPiran_0-1674743899935.gif

     

    I made this video to check how I entered the information.
    thanks for the help

  • bobesponja Profile Picture
    258 on at

    Yes, that is the right way to implement it! The text on the labels will change every time the OnTimerEnd event runs (which could be every second if you wanted to, but this may cause performance issues in some cases).

  • MayranPiran Profile Picture
    83 on at

    Got it... I'll test here
    thanks.

  • bobesponja Profile Picture
    258 on at

    Do you mean that, in your original post, you wanted the user to be able to click on the timer to use its OnSelect event? In that case, you can use a Button instead of the Label, and set the Button's Text value to the code I provided earlier. Then you can set the Button's Fill and Color values as desired. If I understand your case correctly, it would be something like this:

    // Button.Fill
    If(DateDiff(ThisItem.'Hr. Chegada',Now(),Hours) < 2, DefaultColorValue,
    	DateDiff(ThisItem.'Hr. Chegada',Now(),Hours) < 4, Yellow,
    	Red
    )
    
    // Button.Color
    If(Self.Fill=Yellow, Black, White)

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 224 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 189 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 126

Last 30 days Overall leaderboard