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:
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?
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,
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:
from here, the user will go back to the main screen,
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
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,
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,
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?
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
User | Count |
---|---|
165 | |
94 | |
69 | |
64 | |
63 |
User | Count |
---|---|
221 | |
159 | |
96 | |
86 | |
79 |