2

I have a list with a "category" column (a lookup), there's potentially hundreds of items in the list with multiple entries per category. I need to filter the view to only show the most recently modified entry per category.

So let's say the entries for category A were modified on 1st June, 5th June, 12th June, and the entries for Category B were modified on 3rd May, 10th May and 27th May, I would want my filter to show the entry for Category A modified 12th June and the entry for Category B on 27th May.

I'd tried using an item limit but this limit is for the overall list, not on a per category basis (or I should say per group basis as I attempted this with group by set to group by category).

So if I have 100 different categories assigned to different list items, I need all 100 on one page as users will probably further filter the columns on an ad hoc basis as they use this list.

I have other filters in place that ensure the view will never exceed 5000 items.

I'm using SharePoint 2013 and working with a custom list. I'm hoping to find a solution using OOTB functionality or using SharePoint Designer (including workflows).

Any ideas?

  • How about using mulitple ListView-WebParts? Each showing the most recent element of it's configured category. – Mx. Nov 29 '16 at 10:45
  • You can add another Yes/No field like "IsLastModified" and then write a SPD workflow to set the value to "Yes" when the item is modified, then find the previous "IsLastModified" = "Yes" and set it to "No". You will also need to check the category in th workflow. – Gintas K Nov 29 '16 at 11:27
  • Thanks Gintas K; I have created a field called CatMostRecent, the workflow looks up items in the list with the CatMostValue as "<category>Yes", updates it to "<category>No", then sets current item to equal "<category>Yes". This keeps the grouping by category. I need to do the lookup of the other item first, as if I set the current item field to equal "<category>Yes", then when the lookup runs there will be 2 items as <category>Yes. My problem, is the first time I'm logging an entry for a category, there is no "<category>Yes" item so the lookup suspends the workflow. Any ideas to avoid this? – Insert_Nickname_Here Dec 5 '16 at 10:11
1

As suggested by Gintas K I used a workflow to set the last modified item per category - to overcome my last comment I used a web service to count the number of list items of the current item's category and use this to determine how I was setting my most recently modified list item.

Basic steps of the workflow: - web service to count list items of the same category as current item - if the count equals 1 (the 1 being the current item), set the IsLastModified field to being the current one - else: find the item that is set to the last modified item (of the same category), set this to not being the last modified, and then set the current item to being the last modified item

This was necessary, as had I set the current item to being the last modified item, before setting the previously last modified item to 'false', this would have resulted for a brief moment in time to having two items as the last modified item, at which point my workflow would pick at random which one it resets to not being the last modified item.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.