cancel
Showing results for 
Search instead for 
Did you mean: 

obtaining document count

strinchero
Champ in-the-making
Champ in-the-making
Hi all,
is there a way to obtain the total number of document of a given type (and derived types) contained in a space or folder-ish element ?
3 REPLIES 3

kevinr
Star Contributor
Star Contributor
Yes, you can create a FreeMarker template or JavaScript script that can perform this task by using an XPath //* style query that traverses all child descendants of a node.

Take a look at the example templates/scripts provided in the Data Dictionary.

And these are the docs pages (which also have many examples):

http://wiki.alfresco.com/wiki/JavaScript_API
http://wiki.alfresco.com/wiki/Template_Guide

Thanks,

Kevin

strinchero
Champ in-the-making
Champ in-the-making
Looks like a time-consuming operation… since the number of document has to be shown on every request, it will be a better idea to create a node to hold the totals…

Thanks for the answers.

kevinr
Star Contributor
Star Contributor
Yes it would be, it's a deep count operation after all.

Updating that value to keep it in sync might be tricky. A rule that runs at say 3:00am in the morning to perform the count and save the value might be worth doing if you can deal with it not being up-to-date.

Thanks,

Kevin