BrianRudloff.com

.Net Development


My Resume
WebDOCPDF
RTFODTTXT
powered by emurse

Recent comments





Sharepoint Services 2003 - Workaround for filtering on today's date

SharePoint Services 2003 does not initially come with a column for Today's Date.  However, there is a workaround.  Chris Johnson @ msdn wrote a great article on exactly how this works.  But basically, you can trick SharePoint into using Today in a function and create whatever calculated field you need.

I recently had to use this technique to filter a SharePoint Calendar.  I wanted it to display only upcoming events and out of the box, the calendar displays everything.  Here's what I found:

How to Filter a SharePoint Services 2003 Web Part Calendar to Only Show Upcoming Events

1.  Create a new column with the Column Name: Today (It doesn't matter what the type is, so leave it default)

2. Next, create a column with the Column Name: Begins.  In the formula section, enter: =[Start Time].  The data type should be: Date and Time.  The Date and Time format should be: Date Only.

3. Create a new column with the Column Name: Date_Range.  (or something).  In the formula section, enter: =Today-Begins.  The data type should be: Number(1, 1.0, 100).  Set the Number of decimal places to: 0.

4. Here's the weird part.  Go back and delete the original Today column created in Step 1.  I know what you're thinking...but trust me...  If you had read the article I mentioned earlier, you'd understand where this is going.

5. Now Create the Calendar Web Part by Clicking on Edit Page > Add a Web Part > Check Calendar > Click Add.

6. Create the customer view by Clicking on the Calendar Hyperlink > Settings > Create View.  Under "Start From an Existing View", Click Calendar.  Give the Calendar View a Name and then scroll to the bottom of the page and Select "Show items only when the following is true:"  In the first Dropdown box, Select: Date_Range.  In the second Dropdown box, Select "is less than".  Finally, enter a zero (0) into the textbox.

That's it!  When you view your page, you should now have a Calendar Web Part that displays only upcoming events.  If by any chance it’s still showing all events, you may have to play with the view setting for the calendar.

Currently rated 3.0 by 2 people

  • Currently 3/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Categories: Sharepoint
Posted by Brian Rudloff on Thursday, August 30, 2007 8:49 AM
Permalink | Comments (2) | Post RSSRSS comment feed

Related posts

Comments

lakely us

Friday, September 07, 2007 12:47 PM

Gravatar

When I try to create the column 'Begins' on my WSSv3 site I get the following message -
"The formula contains reference(s) to field(s)" and it doesn't create the column.

Tod Beane us

Thursday, December 06, 2007 8:11 PM

Gravatar

Here's a slightly simpler way to filter for current/upcoming events in a Calendar view:

Create the Begins column for your Calendar as described in step 2 above,
with formula =[Start Time] and data type = Date Only.

Then in the view's Filter settings, choose Begins from the first drop-down, choose "is greater than or equal to" from the second drop-down, and enter [Today] in the text box.

If you have already applied a different view to your calendar Web part, choose Modify Shared Web Part and apply the new view as the Web part's Selected View.

Add comment


(Will show your Gravatar icon)  

  Country flag




Live preview

Thursday, August 28, 2008 3:23 AM

Gravatar