What is the easiest way to run a report showing the total number of records in every folder created?
Question
Question
Audit trail on Number of Records in Each Folder
Answer
Or, if getting direct access to SQL is not easy, you can download the entry creation events for the given time range from the Audit Reporter as an Excel spreadsheet and use pivot tables to aggregate the data by folder ID.
Replies
It's certainly possible. However, it won't be efficient to do it with built in tools. You'll want to query directly against the repository database.
Here's what a naïve implementation would look like.
SELECT COUNT(*) AS DocumentCount, t1.name AS ParentFolder FROM LF_Repository.dbo.toc AS t0 LEFT OUTER JOIN LF_Repository.dbo.toc AS t1 ON t1.tocid = t0.parentid WHERE t0.etype = -2 GROUP BY t1.name
However, there are some issues that come to mind. This particular query will only tell you how many documents are in a folder. If there are subfolders, they won't be part of the count of that folder. It will also give you the count for subfolders without differentiating them from their parent. If you want to do a rollup of document counts starting at a certain level in the tree, that's yet another possible query.
If you can tell us more about what the goal of the report is, we might be able to come up with a better solution.
Or, if getting direct access to SQL is not easy, you can download the entry creation events for the given time range from the Audit Reporter as an Excel spreadsheet and use pivot tables to aggregate the data by folder ID.