I have investigated a number of solutions that came close to my requirements, but not one that actually solves this, I think very common, use case:
Often after using feeds, there are duplicate entities created with the same title. Apart from the methods to prevent this from happening, I want to find a solution to list the most recently created entities of which the title already is in use.
When the most recent duplicates are listed, I want to bulk-delete them using views bulk operations.
My approach is as follows:
- Create a view that lists titles of all entities of a certain bundle.
- Turn on aggregation
- Add the entity ID as field, with aggregation 'Count'
- Add a filter: entity ID with aggregation 'Count' is 'more than 1'
The result is a list of entity titles with a column of the count of entities having that title.
Question 1:
So far so good, but I need to see the latest entities listed with an already existing title. How to make that happen?
Question 2:
I need to bulk-delete these most recent duplicates, preferably using Views Bulk Operations. However, when I add VBO(for entities) to the view, this results in an empty output. Probably because the aggregated list shows titles and not entities. This is caused by question 1 not being resolved.
EDIT: I came up with the idea to use this view of duplicate titles, as a filter for another view that should show the latest entities having those titles. So my 3rd question would be:
QUESTION 3: How to create a view that uses the aggregated view mentioned above as its filter, to show the entities having those titles.