Hi all
I have a clock in/out application. There are many different users and some users start at 7AM and others might start at different times. I have If statements inside a switch to recognize which user starts at which time and it works great on my end but when the users start using it, the if and switch statement is failing to recognize what time they start.
Here is an example of the formula and as you can see if the user clocks in past the specified time then it will use current time to sign the user in-
With(
{
wUserStart: DefaultTime.Text
},
Switch(
wUserStart,
StartTime7am.Text,
If(
Now() > DateTimeValue("7:00 AM"),
Now(),
DateTimeValue("7:00 AM")
),
StartTime8am.Text,
If(
Now() > DateTimeValue("8:00 AM"),
Now(),
DateTimeValue("8:00 AM")
),
StartTime9am.Text,
If(
Now() > DateTimeValue("9:00 AM"),
Now(),
DateTimeValue("9:00 AM")
),
//Employees with no start time
If(IsBlank(DefaultTime.Text),
Now()
)
)),
So the DefaultTime.Text is pulling the start time (Text(Gallery.Selected.'Default Start Time', "HH:mm AM/PM") from a gallery that is linked to the dataverse and the users start time column/field. So this label can basically see the users start time.
So if the switch finds a match in the variables then it will use that If statement below it.
This all works great for me when I test, but when the users start clocking in e.g. before 7am, it still doesnt recognize they start at 7am and doesnt round their time up to 7am as seen in the screenshot. Although it worked for 3 users today but thats out of 20.
So it seems like it works sometimes but other times it does? Im not sure if this could have something to do with the users Ipad? But it doesnt make sense that it worked for 3 users so im not sure.
Im really stumped on this one and unsure if theres an alternate way to set this up using dataverse.
Any help is much appreciated and just let me know if you need more info. Thank you