Alfresco · Counting elements by CMIS queries

CMIS does not support COUNT clause for queries. However, CMIS queries can be used to count elements in Alfresco even though this is not the best method in terms of time, overload and bandwidth consumption.

Some examples

1. Counting number of documents of type ks:docType below a parent node [ID]

SELECT cmis:objectId FROM cmis:document where IN_TREE('[ID]') and cmis:objectTypeId='D:ks:docType';

results.getTotalNumItems() returns the number

2. Counting the number of “likes” for contents below a parent node [ID]

SELECT cm:likesRatingSchemeCount FROM cm:likesRatingSchemeRollups where IN_TREE('[ID]');

The sum of all the values in results returns the number

3. Counting the number of comments for contents below a parent node [ID]

SELECT fm:commentCount FROM fm:commentsRollup where IN_TREE('[ID]');

The sum of all the values in results returns the number

4. Counting the number of shared documents below a parent node [ID]

SELECT cmis:objectId FROM qshare:shared where IN_TREE('[ID]');

results.getTotalNumItems() returns the number

2 comentarios en “Alfresco · Counting elements by CMIS queries

Responder

Introduce tus datos o haz clic en un icono para iniciar sesión:

Logo de WordPress.com

Estás comentando usando tu cuenta de WordPress.com. Cerrar sesión / Cambiar )

Imagen de Twitter

Estás comentando usando tu cuenta de Twitter. Cerrar sesión / Cambiar )

Foto de Facebook

Estás comentando usando tu cuenta de Facebook. Cerrar sesión / Cambiar )

Google+ photo

Estás comentando usando tu cuenta de Google+. Cerrar sesión / Cambiar )

Conectando a %s