cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
MH3
Post Prodigy
Post Prodigy

Attendance Application - Button Display Mode

HI,

 

I am developing an attendance application. I figured out all the issues but when creating 2nd record the app buttons display mode seems to not working properly as they should

Example: if someone checks in, and then he forgets to check out in that day and then he opens the app again on 2nd day, then he will see the checkout button still there, because the Display Property I have set to the buttons is this:

Check In Button: > Display Mode Property

If(Gallery2.Selected.Status = "IN",DisplayMode.Disabled,DisplayMode.Edit)

Check in Button > OnSelect Property

  Patch(
       Attendance,    /*my SP List*/
        Defaults(Attendance),
        {
          Title: "Check In&Out Test",
          User: MyUser,
          'User Email': User().Email,
          Check_x0020_In: Now(),
          Status: "IN"
        }
    ); 
Navigate(CheckInSuccess,ScreenTransition.Cover)


CheckOut Button > DisplayMode

 

If(Gallery2.Selected.Status = "IN",DisplayMode.Edit,DisplayMode.Disabled)


CheckOut Button > OnSelect

Refresh(Attendance);
If(
    First(Sort(Attendance,Modified,Descending)).Status="IN",
    Patch(
      Attendance,
       First(Sort(Attendance,Modified,Descending)),
       {
         Check_x0020_Out: Now(),
         Status: "OUT"
       }
     )
);
Navigate(CheckOutSuccess,ScreenTransition.Cover)


I am using a gallery at the backend, which is not displayed to the user, which is like this Sorted in Descending Order:

Annotation 2020-06-25 095908.png

If a user forgets to checkout on that particular day, then if he/she comes yesterday, they should start with a new entry or something like that, they should not enter their CheckOut on the next day as they have forgetten to do so.

 

 

AnyHelp Please? 

 

7 REPLIES 7
v-yutliu-msft
Community Support
Community Support

Hi @MH3 ,

Do you mean that if someone forgot to checkout before, if he log in this app he will not need to check out any more?

The reason why you still need to checkout when user log in in other day is that the status is still "IN", even that user forgot to checkout.

To avoid this problem, you need to change the condition rule.

Could you tell me the formula in items of gallery2?

Try this:

Check In Button: > Display Mode Property

If(Gallery2.Selected.Status = "OUT"||
(Gallery2.Selected.Status = "IN"&&    
 Not(DateValue(Text(Check_x0020_In))=Today())
)
DisplayMode.Edit,Disabled)

 CheckOut Button > DisplayMode

If(Gallery2.Selected.Status = "OUT"||
(Gallery2.Selected.Status = "IN"&&    
 Not(DateValue(Text(Check_x0020_In))=Today())
)
Disabled,DisplayMode.Edit)

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-yutliu-msft ,

 

Actually the thing is, I am not using the gallery for check out or Check In, I am using buttons, gallery is just at the backend, to show the entries, and when the Check in Button is pressed, in the status column "IN" is dropped there and then user is directed back to the view only gallery, where he/she just see the Check in or Check Out Time like this:
Attendance Gallery.png
from here, the user will go back to the main screen, 
Check Out Time.png

The Check in > DisplayMode is this:

If(!IsBlank(LookUp(Attendance,'User Email'=varUserEmail And Status="IN")),DisplayMode.Disabled,DisplayMode.Edit)

 

then the user can checkout, (this works for the same day), but if the user forgets to check out on the same day, this checkout button will always be like this untill the user check out, I want to make that for a new day, the user should input new entry not to enter the checkout for the previous day.

How can I solve this, if you have still questions please ask I will clarify you. @v-yutliu-msft 
 

v-yutliu-msft
Community Support
Community Support

Hi @MH3 ,

Why you gave me different formulas about checkin button's displaymode?

Ok, based on the latest formula that you mentioned, you could try this:

Check In Button: > Display Mode Property

If(
   !IsEmpty(
             LookUp(Attendance,'User Email'=varUserEmail,
                               Status="IN",
                               Not(DateValue(Text(Check_x0020_In))=Today()
                    )
             )||
IsEmpty(
          LookUp(Attendance,'User Email'=varUserEmail,
                             Status="IN"
                 )
        ),
DisplayMode.Edit,
DisplayMode.Disabled
)

 CheckOut Button > DisplayMode

If(
   !IsEmpty(
             LookUp(Attendance,'User Email'=varUserEmail,
                               Status="IN",
                               Not(DateValue(Text(Check_x0020_In))=Today()
                    )
             )||
IsEmpty(
          LookUp(Attendance,'User Email'=varUserEmail,
                             Status="IN"
                 )
        ),
DisplayMode.Disabled,
DisplayMode.Edit
)

 

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-yutliu-msft 

 

I have tried your formula, but it has some errors.

 

Check the ScreenShot:
error_in.jpg

v-yutliu-msft
Community Support
Community Support

Hi @MH3 ,

Sorry , it seems that I forgot some ")".

Try this:

Check In Button: > Display Mode Property

If(
   !IsEmpty(
             LookUp(Attendance,'User Email'=varUserEmail,
                               Status="IN",
                               Not(DateValue(Text(Check_x0020_In))=Today())
                    )
             )||
IsEmpty(
          LookUp(Attendance,'User Email'=varUserEmail,
                             Status="IN"
                 )
        ),
DisplayMode.Edit,
DisplayMode.Disabled
)

 CheckOut Button > DisplayMode

If(
   !IsEmpty(
             LookUp(Attendance,'User Email'=varUserEmail,
                               Status="IN",
                               Not(DateValue(Text(Check_x0020_In))=Today())
                    )
             )||
IsEmpty(
          LookUp(Attendance,'User Email'=varUserEmail,
                             Status="IN"
                 )
        ),
DisplayMode.Disabled,
DisplayMode.Edit
)

 

 

Best regards,

Community Support Team _ Phoebe Liu
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @v-yutliu-msft ,

 

No, there are still errors, it says lookup function received 4 arguments and expected 2 - 3, errors in first if condition.

how to fix?

MH3
Post Prodigy
Post Prodigy

Hi @v-yutliu-msft ,

Any help from your side with the code you shared? it's not working.

 

 

Helpful resources

Announcements
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (2,273)