Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I'm trying to configure a sharepoint list view in Sharepoint services 3.0 to display one each (based on a column) of the latest item. For example, I have 4 Items in my list, two are "Apples" and two are "Oranges". I would like my list view to just display 1 of the latest Apple and 1 of the latest Orange (I would still like this to be the case if there were 500 apples and oranges in my entire_ list. Is there any way to do this in one view without having to setup two seperate views ?

share|improve this question
    
I think you also don't like using a data view webpart or coding your own custom webpart? –  Jan_V Dec 3 '10 at 9:15
    
Dataview or Sharepoint designer work is ok, but if it can be done in sharepoints web interface that would be best. –  user1947 Dec 3 '10 at 9:52

2 Answers 2

Unfortunately I just couldn't find a way to do this with Sharepoint, nor Sharepoint designer or with XSL (not that I tried much XSL). My solution in the end was to apply the following style to the page to remove borders around webparts (you can just use a content editior webpart to apply it to one page )

.ms-PartSpacingVertical 
{
    margin-top: 0px;
}

.ms-PartSpacingHorizontal
{
   width: 0px;
}
</style>

(Source:http://havivi.blogspot.com/2009/08/removehide-empty-space-between-web.html)

Then using sharepoint designer add a dataview item with paging set to one, add a filter for the item type you want, and sort by date modified descending, to make sure you get the latest item. Delete the header row and set the chrome to none You'll have to fix column widths to get it to line up correctly and do some formatting to get it right. Not sexy but it works.

share|improve this answer

I think scenario is complex enough not to be achieved by OOB views. I even doubt if you could achieve this CAML query. Regardless, if you find the answer, please post it.

This can be achieved with Event Receivers and View though. You can have an additional field (try to make it hidden) (say ShowMe) with default value "false". In ItemAdding event, you can query the list and see if there is any record already exist and if yes, Set the ShowMe=false for that record and ShowMe =true for current record. Afterwards, you can filter the view with ShowMe=true.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.