On Mon, Nov 2, 2015 at 1:00 PM, Pascal BASTIEN <pbasnews-xw...@yahoo.fr> wrote:
> Hello, > > I have a xwiki doc class with some properties: 'Static List' type and > 'Page' (multiselect) type. > I try to write a query to retrieve document in one query shot but I > encoutered problem with 'Page' type. > This query working well based on > http://platform.xwiki.org/xwiki/bin/view/DevGuide/velocityHqlExamples#HGettingdocumentswhereobjects27propertiesequalssomevalue > > select distinct doc.name, doc.creationDate from XWikiDocument as doc, > BaseObject as obj, StringProperty prop where (doc.fullName=obj.name and > obj.className='FormSMQ.ACClass' and doc.space='FormSMQ' and > doc.hidden=false and prop.id.id=obj.id and prop.name='P1_Processus' and > prop.value='M3') order by doc.creationDate desc > > 'P1_Processus' is a static list type > > But this query doesn't work: > > select distinct doc.name, doc.creationDate from XWikiDocument as doc, > BaseObject as obj, StringProperty prop where (doc.fullName=obj.name and > obj.className='FormSMQ.ACClass' and doc.space='FormSMQ' and > doc.hidden=false and prop.id.id=obj.id and > prop.name='MY_PAGE_TYPE_PROPERTY_NAME' > and prop.value='MYVALUE') order by doc.creationDate desc > I suppose the 'P1_Processus' property has single selection, which means 'prop.value' is a string and thus you can write "prop.value='M3'". If the Page type property is multiple select then it's value is a list. You should check the "List all blog posts, published and not hidden (filter by multiple properties of an object)" example from http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module#HQueryLanguageExamples . Look for : :category member of blog.category (in the XWQL version) DBStringListProperty as categoryProp join categoryProp.list list (in the HQL version) Hope this helps, Marius > Ididn't find some "PageProperty" in > https://github.com/xwiki/xwiki-platform/blob/master/xwiki-platform-core/xwiki-platform-oldcore/src/main/resources/xwiki.hbm.xml, > then I must use DBStringListProperty ? > > Any help will be welcome. > > Pascal B > _______________________________________________ > users mailing list > users@xwiki.org > http://lists.xwiki.org/mailman/listinfo/users > _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users