-->

Alfresco CMIS query checking for NULL/Blank

2019-08-01 10:20发布

问题:

I want to check whether the Aspect property is present or not and if present it should not be blank... On some docs the aspect applied but no properties are populated. On some docs all the properties of aspect are populated but few are blank.

I tried below queries..

select * from myType:myCase as d join myAspect:myTest as p on d.cmis:objectId = p.cmis:objectId WHERE
CONTAINS(d, 'PATH:"//app:company_home/cm:DROP-FOLDER/*"')

AND p:myAspect:caseId = ''

I also tried p:myAspect:caseId = <> '' **p:myAspect:caseId IS NOT NULL (Doesn't give error but return the row with blank property value)

In short how can I check whether the aspect property is present or not and if present it is not blank?

Thank you

回答1:

I'm not sure I understand what you mean by "if present it should not be blank" (you're probably thinking about properties). If you want to check whether some aspect is there, this in an option:

SELECT * FROM cmis:document where contains('ASPECT:\'myNs:myAspect\'')

Be careful about transactional queries, though. http://docs.alfresco.com/5.0/concepts/intrans-metadata-query.html