SharePoint: CQWP display most recent list item (based on Date) for items with same Title

1.3k Views Asked by At

I have a content query webpart on a page in SharePoint 2010 that is pulling information from a custom list residing in the same site. The purpose of this list is to store the dates (start time, end time) for upcoming training sessions.

Here is what I am trying to accomplish: I would like my CQWP to provide a list of training sessions, BUT only display the most recent training session. For example, a training session titled (Basic HTML Training) may be given 10 times. I need the CQWP to hide every Basic HTML Training session besides the most recent one. At the same time, I have many other classes with many training sessions. These other classes need to be presented the same way. So classes need to be 'grouped' somehow based on their title column, and then each 'group' should only display the most recent training session based on the date column.

I am not sure how to accomplish this.


EXAMPLE: If the following items are in a list:

Training 1
1/10/12

Training 1
1/15/12

Training 1
1/20/12

Training 2
1/15/12

Training 2
1/20/12

Training 2
1/25/12


The webpart should display:

Training 1
1/20/12

Training 2
1/25/12

1

There are 1 best solutions below

0
On

Try adding a custom XSL to CQWP and then use grouping and datetime checks in XSL to display the results.