Welcome to MSDN Blogs Sign in | Join | Help

Creating a view on a list to display items created YESTERDAY

We can easily filter a list to show everything created today by using the [Today] variable, but I was just asked by a colleague if it is possible to filter on [Yesterday]. For example I have an Issues List and if today’s date is 25th April, I want to show issues that were created on 24th April.

As you may or may not be aware it is not possible to simply substitute [Today] for [Yesterday] or [Today]-1 so this is how I went about solving the little problem.

Firstly create your list and add a calculated field with the value of "=[Created]+1".

This will automatically create you a field with tomorrows date in it, Sounds a bit wierd at the moment but hang in there!

Next we need to create a view on the list we need to filter, I simply created a new view called "Yesterdays Issues" and filtered it on the "Tomorrows Date" field where all entries equal [Today].

Now if you create a new item in your list and switch to the "Created Yesterday" view you should see there are no entries.

However if you wait until tomorrow, or wind your system clock on a day and click refresh you should see all the entries created 'Yesterday'

Hello and Welcome!

Hello and Welcome to my Blog, I have recently started working for Microsoft UK within the Services organisation focusing on SharePoint Products and Technologies and looking into the future of Collaboration with Microsoft Office Sharepoint Server (MOSS).

Here you will find any useful nuggets of information around the above technologies with the occasional bit of LCS and XBOX360 for good measure :)

Enjoy!

Andy.

Posted by Andy Day | 0 Comments
 
Page view tracker