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 / Make "clock in" appear...
Power Apps
Unanswered

Make "clock in" appear when "Clock out" was the last button pressed

(0) ShareShare
ReportReport
Posted on by 391

Hello! I have posted this question before, but after a month more experience with powerapps, I want to address some issues I am having with this. 

The goal is to populate a clock in button when clock out was the last button pressed OR when there is no records for the current day. 

In my previous fix for this it worked intermittently. Randomly the clock in button will not work as expected, meaning it won't show up after clocking out, leaving the app, and reopening the app. I'd like to find a solution that will work consistently. 

I was trying to do something like this, but it is showing that I have a table where it's expecting a Boolean. This is on the Visible property of the clock in button. Anyone have any suggestions? For context TimeTracker is a sharepoint list. Title is the users email address. 

If(Filter(TimeTracker, UpdatedActivityDateTime=Today(), glbUser=Title), IsBlank('Time Out'), true, false)



Categories:
I have the same question (0)
  • RogierE Profile Picture
    879 Moderator on at

    The output of the Filter function is a table, that is not what the If function would expect as input. It expects a boolean value (true/false). This is the outcome of an Isblank function, so you're close to the solution but not close enough 🙂 

    I guess your code would work better like this:

    If(IsBlank(Lookup(TimeTracker, And(UpdatedActivityDateTime=Today(), glbUser=Title)),'Time Out')), true, false)

     

    But now that you know that a Boolean is a value that is either true or false, I hope you will see this further improvement of your code (less is better). You can just fill this in your Visible property:

    IsBlank(Lookup(TimeTracker, And(UpdatedActivityDateTime=Today(), glbUser=Title)),'Time Out'))

     

    Enjoy!

     

    Please LIKE the reply and ACCEPT it as the solution if the answer is what you were looking for.
    (to help me grow in community rank and help others find the solution)

     

     

  • CodyO Profile Picture
    391 on at

    @RogierE Thank you for sharing your knowledge and experience! It appears the code you provided is showing an error. I was able to get it fixed most the way on my end, however it is claiming that "Time Out" is not recognized. I am unsure why this is happening. I refreshed my data source, and verified that the column I am pulling data from matches (Capital T&O, and space between the two words). Is there another reason it wouldn't detect it that I am missing? 

  • RogierE Profile Picture
    879 Moderator on at

    This is a SharePoint list column is it? Could it be that the name has changed from the original name? There is one very nasty thing to know about SharePoint Lists and that is that if you rename a column, the displayname changes, but the actual name stays the same. If a column name has changed, you still need to refer to the original name in PowerApps. You can check out the original column name, by going to your list in the SharePoint, then to List Settings (at the gearwheel), and click the column in that screen. You'll get to something like this:

    RogierE_1-1711631406872.png

    You can see here that the new name is Changed, while the old name as shown in the address bar is Modified.

    In this example the name that I would need to refer to is Modified

     

    Please LIKE the reply and ACCEPT it as the solution if the answer is what you were looking for.
    (to help me grow in community rank and help others find the solution)

     

  • CodyO Profile Picture
    391 on at

    @RogierE This is a sharepoint list, I took a look and this is what I see

    CodyO_0-1711637395750.png

    So I figured it would be "TimeOut"; I am still getting the same issue of it not being recognized

    IsBlank(Lookup(TimeTracker, And(UpdatedActivityDateTime=Today(), glbUser=Title)),TimeOut))

  • RogierE Profile Picture
    879 Moderator on at

    The screen shot doesn’t show me the column name…

    But you can try another approach. If you select the word Timetracker in your formula bar, you can see the actual contents of the list and how it is received by the App. Scroll right until you see the TimeOut column and double check it’s name in the list. 

  • CodyO Profile Picture
    391 on at

    @RogierE I tried that other approach, and it is showing as TimeOut! Lesson learned - I can view table details in a way I didn't know

    CodyO_0-1711655867425.png

     

  • RogierE Profile Picture
    879 Moderator on at

    Good that you learnt. And I guess i had a typo in sharing the code. There is a bracket top many behind Title . Thats why you still received an error . I guess this is the right code:

    IsBlank(Lookup(TimeTracker, And(UpdatedActivityDateTime=Today(), glbUser=Title),TimeOut))

     Please LIKE the reply and ACCEPT it as the solution if the answer is what you were looking for.
    (to help me grow in community rank and help others find the solution)

  • CodyO Profile Picture
    391 on at

    I gave it a test, and it wasn't quite working correctly, so I attempted to change the code to !IsBlank referring to TimeOut. This sorta worked, but I was left with the same problem of Clock In not appearing/dissapearing at the correct times. 1st screenshot I am posting is with your code, 2nd is with !IsBlank, 3rd is with !IsBlank after clocking in.

    CodyO_0-1711658735429.pngCodyO_1-1711658773332.png

    CodyO_2-1711658835372.png

     

     

  • RogierE Profile Picture
    879 Moderator on at

    Okay, let's get back to your original requirement.

    "The goal is to populate a clock in button when clock out was the last button pressed OR when there is no records for the current day."

    The formula only covered the first part, and then with !IsBlank

    But for the second part you should add an extra check:

     

    Or(!IsBlank(Lookup(TimeTracker, And(UpdatedActivityDateTime=Today(), glbUser=Title),TimeOut)),CountIf(TimeTracker,And(UpdatedActivityDateTime=Today(), glbUser=Title))=0)

     

     

     

    And then one more step: i personlly find they above code ugly and complex. There is a reason why they say that "code is poetry". And that is because you should revisit and rewrite it until it is beautifully simple. So I re-thought your requirement. You could als say as an alternative requirement "do not show as long as there is an open task for the user" which would lead to a simpler piece of code:

    CountIf(TimeTracker,And(UpdatedActivityYime=Today(),blbUser=Title,IsBlank(TimeOut)))<1

     

    Please LIKE the reply and ACCEPT it as the solution if the answer is what you were looking for.
    (to help me grow in community rank and help others find the solution)

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 551

#2
WarrenBelz Profile Picture

WarrenBelz 430 Most Valuable Professional

#3
Valantis Profile Picture

Valantis 298

Last 30 days Overall leaderboard