SOLVED

Night Shift Data

Copper Contributor

Hi!

 

I am currently facing an issue that I hope someone can help me with.

At the moment, I have created a SharePoint list with quite a few columns. 

These shall be filled out to show data on orders.

However, I would like to have a new view created that shows only the night shift data, in the night shift time period. For example, our night shift team start at 7pm and finish at 6am the next morning. 

Can I have a view to only show their inputted data from between these times? And then at 6am have the view be blank until the next night shift team come in and fill in their own data? Hopefully this makes sense.

 

Thanks,

Joseph.

5 Replies

@JosephD13 

Yes, it is possible to create a SharePoint view that displays only the data entered during the night shift time period. You can achieve this by using the built-in filtering capabilities of SharePoint views. Here's how you can set it up:

 

1. Go to the SharePoint list where you want to create the view.

2. Click on the "Create View" or "Modify View" option to create or edit a view.

3. In the view settings, scroll down to the "Filter" section.

4. Add a filter based on the time period for the night shift. For example, if the night shift starts at 7 PM and ends at 6 AM, you can use the following filter:
- Field: Created (or any other relevant field that captures the time of data entry)
- Operator: Greater than or equal to
- Value: [Today]+19:00 (where 19:00 is the start time of the night shift)

5. Save the view with an appropriate name, such as "Night Shift Data."

 

Now, the view will only display the data entered during the night shift time period. Once it is 6 AM and a new day begins, the view will be empty until the next night shift team enters their data.

 

Keep in mind that the specific steps may vary slightly depending on the version of SharePoint you are using and the customization options available. Additionally, ensure that the time zone settings in SharePoint align with the time zone of your night shift team to accurately filter the data.

 

If I have answered your question, please mark your post as Solved
If you like my response, please give it a like
best response confirmed by JosephD13 (Copper Contributor)
Solution

@Deleted that won't work, it will give an error because [Today] doesn't contain a time value so you can't use [Today]+19:00

 

@JosephD13 I don't think this is possible just using views in SharePoint Online, and of course you can't use Filters like [Today] in calculated columns. But what you want to do is quite easy with a Power App using your Night Shift list as the data source. The advantage of this method is that you can quickly select the events for any night shift very quickly and it will ignore the day shift events. I've done a quick mockup & video of this which is attached. If you want the details of how to build this and the formulas that I've used just let me know.

 

Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)

Hi Rob!

Thank you so much for your help with this!
Could you provide me with the details as to how I can build this, including formulas etc?
You have really went out of your way to help me here! I appreciate this very much.

Thanks,
Joseph.
Sorry for the delay in getting back to you, work got in the way. I'll do the guide on how to build it during today.

@JosephD13 here is the guidance on creating it. In this  example the name of the person reporting the event goes into the Title column and the event into the multiple lines of text Event column. In the view we display the Created column.

0-SP.png

 

1. In Power Apps create a new canvas app. Down the left hand side I have added a container and uploaded a logo.

1-Container.png

 

2. Add a date picker control, rename it to dpFrom and set the DefaultDate property to Today()

2-dpFrom.png

 

 

3. Add another date picker control, rename it to dpTo and set the Display mode to View so that dates can't be manually entered into it. Set the DefaultDate property to dpFrom.SelectedDate+1

3-dpTo.png

 

4. On the main part of the screen,i.e. outside the container, add a label, rename it to lblShiftFrom and set the Text property to Text(DateValue(dpFrom.SelectedDate) &" "& Time(19,0,0))

 

4-lblShiftFrom.png

 

5. Add another label and rename it to lblShiftTo and set the Text property to 
Text(DateValue(dpTo.SelectedDate) &" "& Time(06,0,0))

 

5-lblShiftTo.png

 

6. Make sure you've added a connection to your SharePoint list:

6-dataSource.png

 

 7. Click on the app icon and select the OnStart property and enter ClearCollect(colEvents, NightShift) which will create a collection from the SharePoint list when you start your app - you could do it without a collection, but it's more efficient with one as your list grows.

 

7-OnStart.png

 

8. Then make sure you Run OnStart:

 

8-RunOnStart.png

 

9. You can refresh the collection, getting any new data from the list by adding a button, rename it to btnRefresh and in the OnSelect property add ClearCollect(colEvents, NightShift) again.

 

9-btnRefresh.png

 

10. Add a data table or a gallery. I've done it with a data table but if you want to opn up the form with more fields you'd need a gallery. Edit the fields you want in the table from the link in the properties pane on the right of the screen. In the Items property of the data table add 

Sort(Filter(colEvents, Created >= DateTimeValue(lblShiftFrom) && Created <= DateTimeValue(lblShiftTo)), Created, SortOrder.Descending)

 

which will filter the collection to display just the events recorded from 19:00 on the date selected to 06:00 on the following day.

 

10-dataTable.png

 

And this is the result.

 

12-App.png

 

11-App.png

 

Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)

1 best response

Accepted Solutions
best response confirmed by JosephD13 (Copper Contributor)
Solution

@Deleted that won't work, it will give an error because [Today] doesn't contain a time value so you can't use [Today]+19:00

 

@JosephD13 I don't think this is possible just using views in SharePoint Online, and of course you can't use Filters like [Today] in calculated columns. But what you want to do is quite easy with a Power App using your Night Shift list as the data source. The advantage of this method is that you can quickly select the events for any night shift very quickly and it will ignore the day shift events. I've done a quick mockup & video of this which is attached. If you want the details of how to build this and the formulas that I've used just let me know.

 

Rob
Los Gallardos
Intranet, SharePoint and Power Platform Manager (and classic 1967 Morris Traveller driver)

View solution in original post