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 ?
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 )
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.
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.