cancel
Showing results for 
Search instead for 
Did you mean: 

CQL: how to order documents by title (description,author...)

serverok
Champ in-the-making
Champ in-the-making
Hi All,

I have the question:
how can I order the Documents by Title (cm:title), Description (cm:description), Author (cm:author), etc. in CQL?

for example, this code works great:
SELECT D.* FROM Document AS D ORDER BY D.Name

BUT:
SELECT D.* FROM Document AS D ORDER BY D.Title
or
SELECT D.* FROM Document AS D ORDER BY D.Description
will return errors: "Invalid column for document.Title selector alias D"  OR "Invalid column for document.Description selector alias D"

In the WiKi I can't find how this properties are mapped (http://wiki.alfresco.com/wiki/CMIS_Model_Mapping). maybe community can help me in this situation.

Big thanks.
1 REPLY 1

jpotts
World-Class Innovator
World-Class Innovator
Old post, but in case it helps someone, the title and description are defined in an aspect. CMIS 1.0 doesn't support aspects natively but Alfresco implements support for aspects through joins. So here is how you'd find all documents with a name like *test* ordered by their description:

select d.*,t.* from cmis:document as d join cm:titled as t on d.cmisSmiley SurprisedbjectId = t.cmisSmiley SurprisedbjectId where d.cmis:name like '%test%' order by t.cm:description

Jeff