
Announcements
Hello, I am planning on building out an app that would act like a timesheet but also tracks other details for deliveries to a client with a sign off functionality.
One of the functions I want to add is being able to track the individual deliveries in a day. For each delivery there should be an arrival time and a departure time. The arrival time of the first job and departure time of the last job are the Start time and end time of the entire day.
So for example these entries would be done by manual input and there could up to 15-20 deliveries in a day:
Job 1: arrive at 8:00AM Depart at 12:00PM
Job 2: arrive at 1230PM Depart at 430PM
The final output for the day would be auto calculated based on the job entries.
Days start time 8AM and end time is 430PM with the total hours being 8.5 hours.
Would anyone be able to point me in the direction of the right resources that would help as I am struggling with what components to use to capture the time entries and how to create the sharepoint columns and then do the automatic calculations.
Any help or advise would be greatly appreciated.
Hi @RogerCP66 ,
Please try:
With(
{Temp:
"Job 1: arrive at 8:00AM Depart at 12:00PM
Job 2: arrive at 12:30PM Depart at 4:30PM"
},
With(
{
Start:Min(ForAll(MatchAll(Temp,"arrive at \d?\d:\d\d[A,P]M"),DateTimeValue(Match(FullMatch,"\d?\d:\d\d[A,P]M").FullMatch)),Value),
End:Max(ForAll(MatchAll(Temp,"Depart at \d?\d:\d\d[A,P]M"),DateTimeValue(Match(FullMatch,"\d?\d:\d\d[A,P]M").FullMatch)),Value)
},
$"Days start time {Text(Start,DateTimeFormat.ShortTime)} and end time is {Text(End,DateTimeFormat.ShortTime)} with the total hours being {DateDiff(Start,End,TimeUnit.Minutes)/60} hours."
)
)
Best Regards,
Bof