Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

How can I create a list view with a filter on a date column so that only items for the most recent date are displayed?

Posted on 2012-08-10
4
Medium Priority
?
1,466 Views
Last Modified: 2012-08-13
Hello:

I have created a custom list in SharePoint 2007 (MOSS 2007).  There is a date column called week ending.  I would like to be able to create a new view on the list that shows only items that match the maximum value within the "Week Ending" column.  For instance, if I have 4 items with a "Week Ending" value of 7/20/2012 and 3 items with a "Week Ending" value of 8/3/2012, I would like for the view to display only the items with a "Week Ending" value that matches 8/3/2012.  I created a Calculated Column set to =Max([Week Ending]) but it returns the Week Ending value of the current row.....not the maximum Week Ending in the list.  I also tried to set the filter to (Where [Week Ending] is equal to [Max Week Ending]) and it gives me a "Filter value not is a supported date format" error.  The [Week Ending] column is a date only type and the [Max Week Ending] column is set to return a date only type.  Any ideas on how to achieve this using only "out-of-the-box techniques"?

Thanks
0
Comment
Question by:BLEIP
  • 2
  • 2
4 Comments
 
LVL 44

Assisted Solution

by:Rainer Jeschor
Rainer Jeschor earned 2000 total points
ID: 38284090
Hi,
it is not a 100% solution but a 80% one.
Create a new view. Add the necessary columns and put the week ending at first place.
Then add a "Group By" and group by Week Ending field with a descending order. Set "Number of groups to display per page: " to 1 and e.g. modify the maximum of returned items.
Save the view and you will now get a page with all items with the max week ending.
If you now want to hide the navigation then you would have to add some jQuery/Javascript code to the view page.

HTH
Rainer
0
 

Author Comment

by:BLEIP
ID: 38287838
Rainer:

Thanks.  Setting the groups per page to 1 is somewhat a solution but I'm really trying to figure out a way to accomplish basically the same thing but display that one group in expanded form.  It stinks that the groups per page option is only available when the groups are set to collapsed.  Any other ideas?

Thanks
0
 
LVL 44

Accepted Solution

by:
Rainer Jeschor earned 2000 total points
ID: 38288064
Hi,
use the "1 group per page".
Then you will have to open the view page (not the settings one), click in "Site Actions" -> "Edit Page" and add a Content Editor Web Part below the list view.
In the CEWP edit the "Source" and paste the following JavaScript:
<script type="text/javascript">
ExpCollGroup('1-1_','img_1-1_');
</script>

Open in new window

Set the Chome Type to "None" and save. Now whenever you open the View page you should see the date expanded.

HTH
Rainer
0
 

Author Comment

by:BLEIP
ID: 38289349
Rainer:

Thanks.  I tried your JavaScript code and it didn't work but after I took a look at the source code, I found the IDs were different and adjusted as necessary and they now work.  Thanks again.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft has changed the look and feel of Azure AD and Microsoft account sign-in pages so that you will have a more unified look and feel when moving between the two interfaces.
I came across an unsolved Outlook issue and here is my solution.
This video shows where to find templates, what they are used for, and how to create and save a custom template using Microsoft Word.
The viewer will learn how to use a discrete random variable to simulate the return on an investment over a period of years, create a Monte Carlo simulation using the discrete random variable, and create a graph to represent the possible returns over…

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question