Hi,
I've been playing with Powerapps the last couple of weeks and its been really fun except when I can't figure something out and I'm scrolling through miles of threads to find the one bit of code that might work or might not.
Anyway, at the moment I'm trying to make an app (for work Covid tracking an do away with a physical form).
I'm not even sure if it can be done as it seems too complicated in that it might be too hard to associate what row to pick when the user is showing on the list multiple times because they're expected to sign out whenever they leave the building (i.e for lunch or meetings etc.) and then sign in again when they return. Anyway, the way I want it is to have;
*A sign in button that when tapped signs them in (writes to a sharepoint list Name, time in, status in/out)
I would also like to have this button only visible if they haven't signed in (to avoid creating multiple 'in" rows and they know exactly if they have signed in or not).
*A sign out button that signs them out and writes to that same row time out and changes the status to out.
I would also only want this button to show if they are signed in and need to sign out.
Then the tricky bit is, I want them to be able to sign in again but create a new row when they do rather than modifying any of the existing rows.
In Sharepoint my columns are Title for name (Been using "(Text(User()Full.Name))" to fill the row), Time in , Time out, (both text fields been using "Text(Now(),"[$-en-GB]dd/mm/yyyy hh:mm:ss") and a choice column called Status which has In/Out.
I'm going to manually shift them all to a Daily list (or create a new Sharepoint file every night and change the apps source, whichever might be easier) to help keep the list slim.
Any help is very much appreciated. Thank you!
Solved! Go to Solution.
Hi @Chameleon,
Do you want to create a sign in and sign out button and write status back to SP list?
Could you please share a bit more about the scenario?
I want to confirm with you that if you save all the info into a single SP list, I think you should create a new SharePoint file every night to help keep the list slim.
I have made a simple test for you, please take a try as below.
1). A sign in button that when tapped signs them in and have this button only visible if they haven't signed in.
Set the Visible of the sign in button as below:
If(IsBlank(LookUp(Tracking,User().Email in Name).Name),true,false)
Set the OnSelect of the sign in button as below:
If(
IsBlank(
LookUp(
Tracking,
User().Email in Name
).Name
),
Patch(
Tracking,
Defaults(Tracking),
{
Name: User().Email,
'Time in': Text(
Now(),
"[$-en-GB]dd/mm/yyyy hh:mm:ss"
),
Status: {Value: "In"}
}
)
)
2). A sign out button that signs them out and show if they are signed in and need to sign out.
Set the Visible of the sign out button as below:
If(
!IsBlank(
LookUp(
Tracking,
User().Email in Name
).Name
) && CountRows(
Filter(
Tracking,
User().Email in Name,
Status.Value = "In"
)
) > 0,
true,
false
)
Set the OnSelect of the sign out button as below:
If(
CountRows(
Filter(
Tracking,
User().Email in Name
)
) = 1,
Patch(
Tracking,
LookUp(
Tracking,
User().Email in Name
),
{
'Time out': Text(
Now(),
"[$-en-GB]dd/mm/yyyy hh:mm:ss"
),
Status: {Value: "Out"}
}
),
If(
CountRows(
Filter(
Tracking,
User().Email in Name
)
) > 1,
Patch(
Tracking,
Last(
Filter(
Tracking,
User().Email in Name
)
),
{
'Time out': Text(
Now(),
"[$-en-GB]dd/mm/yyyy hh:mm:ss"
),
Status: {Value: "Out"}
}
)
)
)
3). Add another sign in button if you want to sign in again, set the Visible of this button as below:
If(Button_SignIn.Visible=false &&Button_SignOut.Visible=false,true,false)
Set the OnSelect of this button as below:
Patch(
Tracking,
Defaults(Tracking),
{
Name: User().Email,
'Time in': Text(
Now(),
"[$-en-GB]dd/mm/yyyy hh:mm:ss"
),
Status: {Value: "In"}
}
)
Hope it could help you at some degree.
Hi @Chameleon,
Do you want to create a sign in and sign out button and write status back to SP list?
Could you please share a bit more about the scenario?
I want to confirm with you that if you save all the info into a single SP list, I think you should create a new SharePoint file every night to help keep the list slim.
I have made a simple test for you, please take a try as below.
1). A sign in button that when tapped signs them in and have this button only visible if they haven't signed in.
Set the Visible of the sign in button as below:
If(IsBlank(LookUp(Tracking,User().Email in Name).Name),true,false)
Set the OnSelect of the sign in button as below:
If(
IsBlank(
LookUp(
Tracking,
User().Email in Name
).Name
),
Patch(
Tracking,
Defaults(Tracking),
{
Name: User().Email,
'Time in': Text(
Now(),
"[$-en-GB]dd/mm/yyyy hh:mm:ss"
),
Status: {Value: "In"}
}
)
)
2). A sign out button that signs them out and show if they are signed in and need to sign out.
Set the Visible of the sign out button as below:
If(
!IsBlank(
LookUp(
Tracking,
User().Email in Name
).Name
) && CountRows(
Filter(
Tracking,
User().Email in Name,
Status.Value = "In"
)
) > 0,
true,
false
)
Set the OnSelect of the sign out button as below:
If(
CountRows(
Filter(
Tracking,
User().Email in Name
)
) = 1,
Patch(
Tracking,
LookUp(
Tracking,
User().Email in Name
),
{
'Time out': Text(
Now(),
"[$-en-GB]dd/mm/yyyy hh:mm:ss"
),
Status: {Value: "Out"}
}
),
If(
CountRows(
Filter(
Tracking,
User().Email in Name
)
) > 1,
Patch(
Tracking,
Last(
Filter(
Tracking,
User().Email in Name
)
),
{
'Time out': Text(
Now(),
"[$-en-GB]dd/mm/yyyy hh:mm:ss"
),
Status: {Value: "Out"}
}
)
)
)
3). Add another sign in button if you want to sign in again, set the Visible of this button as below:
If(Button_SignIn.Visible=false &&Button_SignOut.Visible=false,true,false)
Set the OnSelect of this button as below:
Patch(
Tracking,
Defaults(Tracking),
{
Name: User().Email,
'Time in': Text(
Now(),
"[$-en-GB]dd/mm/yyyy hh:mm:ss"
),
Status: {Value: "In"}
}
)
Hope it could help you at some degree.
OMG! Thank you so much! Works perfectly!
I learned so much (whether I retain it or not is another thing). So many different formulas that didn't even cross my mind but make so much sense.
Thank you again! I'd pay you if I could! (I wouldn't, I'm poor, but I'd find something)
User | Count |
---|---|
258 | |
111 | |
95 | |
48 | |
41 |