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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Change Check in and ch...
Power Apps
Answered

Change Check in and check out time each time button is Pressed.

(0) ShareShare
ReportReport
Posted on by 5

Hi,

 

We are developing a fitness app that allows users to check in and check out of their workout sessions. When the user checks in, we want the "check-in" button to be disabled and display the check-in time on the button. After the user has finished their workout, they can check out by pressing a different button which says "check out". This will disable the "check-out" button and enable the "check-in" button again. I also want the check out button to be greyed out until check in is pressed. 

 

Any ideas what code need to be written to do so ^

Thanks!

Categories:
I have the same question (0)
  • Verified answer
    CNT Profile Picture
    10,921 Super User 2024 Season 1 on at

    @Demha3333 You can use a variable to do this. Set this variable in the OnVisible of the Screen

    UpdateContext({varCheckedIn: false})

    Set the DisplayMode of the CheckIn Button to,

    If(varCheckedIn, DisplayMode.Disabled, DisplayMode.Edit)

    Set the DisplayMode of the CheckOut Button to,

    If(varCheckedIn, DisplayMode.Edit, DisplayMode.Disabled)

    In the OnSelect of the CheckIn Button

    UpdateContext({varCheckedIn: true})

    In the OnSelect of the CheckOut Button

    UpdateContext({varCheckedIn: false})

     

    Please remember to give a 👍 and accept my solution as it will help others in the future.

  • Demha3333 Profile Picture
    5 on at

    Thank you, another problem i am facing is that the booking time I want that registeres a users check in and check out time, needs to ble cleared, when the booking time/date is expired. 

     

    Check the picture below. For now the check in time and check out stays there, so that users can see its future or live check in/bookings. But when the date is expired, i want it to be removed from that gallery where it says "Mine bookinger". Any ideas..?

     

    My code :

    Under Items on the gallery:

    SortByColumns(Filter(Treningsapp;Title = glbUser.FullName);"SjekkInnTid";SortOrder.Ascending)

    Onselect on Sjekk inn button:

    If(mytext = "Sjekk inn"; UpdateContext({mytext: "Sjekk inn"}); UpdateContext({mytext: Text(Now(); "hh:mm")})) ;;
    ClearCollect(
    colEnableButton;
    {
    SjekkInnTid : Now();
    Bruker :If(Anonym.Value=true;"Anonym"; glbUser.FullName)
    }

    );;
    Set(sjekkInnRecord;
    Patch(Treningsapp;Defaults(Treningsapp);
    {

    Title:If(Anonym.Value=true;"Anonym";glbUser.FullName);
    SjekkInnTid :Now()
    //Bruker:If(Anonym.Value=true,"Anonym",glbUser.FullName)
    }
    )
    );;
    Reset(Anonym);;
    UpdateContext({varSjekkinn: true})

     

    Onselcet on Check out button:

    If(mytext = "Sjekk ut"; UpdateContext({mytext: "Sjekk ut"}); UpdateContext({mytext: Text(Now(); "hh:mm")})) ;;
    ClearCollect(
    colEnableButton;
    {
    SjekkUtTid : Now();
    Bruker :If(Anonym.Value=true;"Anonym"; glbUser.FullName)
    }
    );;
    Refresh(Treningsapp);;
    If(
    !IsBlank(sjekkInnRecord);
    Patch(Treningsapp;
    sjekkInnRecord;
    {

    Title:If(Anonym.Value=true;"Anonym";glbUser.FullName);
    SjekkUtTid:Now()
    //Bruker:If(Checkbox1.Value=true,"Anonym",glbUser.FullName)
    }
    )
    );;
    Reset(Anonym);;
    UpdateContext({varSjekkinn: false})

     

    And under gallery i have set up two labels.

    1. Under "Text" on label1 one its: ThisItem.SjekkInnTid

    2. under "Text" on label two its: ThisItem.SjekkutTid 

     

    Demha3333_0-1681904846790.png

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard