Friday, July 29, 2011

Sharepoint Dataview Last 7 days filter

I am creating a dataview within Sharepoint Designer 2007 that uses a Sharepoint list as its database. All is fine and is working well but I want to filter from 7 days before today’s date. I could manually set the date but then I would have to change it everyday…

My solution is to set the filter for Current date and save.

Sharepoint Filter Criteria

Sharepoint Filter Criteria

Go to code view and locate the “Select Command” for the filter. Within that command there should be a entry like:

Type="DateTime"><Today

or something simular. Change to

Type="DateTime"><Today OffsetDays="-7"

where 7 being the number of days you wish to filter from. You also need to use " for ” and > for > etc

No comments: