Summary
I'm developing an application that creates and manages a work schedule. There are two shifts, day and night shift. A manager or shift lead can create a schedule, which is saved to a database and emailed to the company. This schedule can be viewed by anyone in the company within PowerApps
Then, when a delivery is being made, a driver will create a log of which worker and their job role was on the delivery. Each delivery or job is then saved to databased, a report is emailed, and can be viewed within PowerApps.
There are 5 locations in which a delivery can originate.
For purposes of brevity, I will skip the email portion of the app and skip how to save data to a database, as these topics have been covered extensively in other posts.
Data
The data table contains the following columns:
[Id] INT IDENTITY (1, 1) NOT NULL,
[Date] DATETIME NULL,
[CallSign] NVARCHAR (50) NULL,
[Station] NVARCHAR (50) NULL,
[VehicleNumber] NVARCHAR (50) NULL,
[Driver] NVARCHAR (50) NULL,
[Navigator] NVARCHAR (50) NULL,
[Crew1] NVARCHAR (50) NULL,
[Crew2] NVARCHAR (50) NULL,
[Crew3] NVARCHAR (50) NULL,
[ShiftType] NVARCHAR (50) NULL,
Steps
Here's the steps that I know I have to do to make this work:
- Create a collection (either OnStart or after the Crew Schedule is updated)
- This collection will contain data from the "CrewSchedule" table.
- It will only collect the most recent changes to the schedule.
- There will be a separate row depending on if it Day or Night shift.
- Each row will be location specific.
- Use Distinct
- When a driver selects a location, then either Day or Night Shift.
- The rest of the form auto-populates.
- I already know how to use the Distinct formula when using a dropdown menu.
Current Issues
- Creating a collection with these specific parameters
- This part is straight forward
- ClearCollect(CachedSchedule, '[dbo].[CrewSchedule]')
My dilemma is this, how does one create a collection that updates based on the latest changes and creates a row that's specific on both location and shift? Since there are 5 locations and two different shifts per location, there should only be 10 rows total. Is there some sort of nested If statement that has to be used when creating this specific Collection?
I appreciate any input on how to solve this problem. I figured that an application like this can help as this can be used for all sorts of businesses that provide a delivery service or conduct on-site work. Thanks!
Brendon