Re: [xwiki-users] Need help to find a hql query
Yes thxs (gdelhumeau helped me on irc). => I update doc: http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module I used wrong value like you found too :-) -------------------------------------------- En date de : Mar 3.11.15, Marius Dumitru Florea <mariusdumitru.florea@xwiki.com> a écrit : Objet: Re: [xwiki-users] Need help to find a hql query À: "Pascal BASTIEN" <pbasnews-xwiki@yahoo.fr> Date: Mardi 3 novembre 2015, 11h01 On Mon, Nov 2, 2015 at 5:15 PM, Pascal BASTIEN <pbasnews-xwiki@yahoo.fr> wrote: I didn't manage to use blog example on xwiki 7.0.1 (I replace 'XWiki.ArticleClass' by 'Blog.BlogPostClass' : we must fix doc if it is ok) The query example don't work (or maybe I don't know how to use it ;-) ) select distinct doc.fullName, doc.creationDate from XWikiDocument as doc, BaseObject as obj, DBStringListProperty as prop join prop.list list where obj.name=doc.fullName and obj.className='Blog.BlogPostClass' and obj.id=prop.id.id and prop.id.name='category' and list='${category}' order by doc.creationDate desc This works fine for me: select distinct doc.fullName, doc.creationDate from XWikiDocument as doc, BaseObject as obj, DBStringListProperty as prop join prop.list list where obj.name=doc.fullName and obj.className='Blog.BlogPostClass' and obj.id=prop.id.id and prop.id.name='category' and list='Blog.News' order by doc.creationDate desc You probably don't have the right value in $category. Hope this helps, Marius If I remove category parameter #set ($query ="select distinct doc.fullName, doc.creationDate from XWikiDocument as doc, BaseObject as obj, DBStringListProperty as prop join prop.list list where obj.name=doc.fullName and obj.className='Blog.BlogPostClass' order by doc.creationDate desc") the query return all doc with blog class -------------------------------------------- En date de : Lun 2.11.15, Marius Dumitru Florea <mariusdumitru.florea@xwiki.com> a écrit : Objet: Re: [xwiki-users] Need help to find a hql query À: "Pascal BASTIEN" <pbasnews-xwiki@yahoo.fr>, "XWiki Users" <users@xwiki.org> Date: Lundi 2 novembre 2015, 13h47 On Mon, Nov 2, 2015 at 1:00 PM, Pascal BASTIEN <pbasnews-xwiki@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#HGetti... 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#HQueryLang... . 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/xwik..., 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
I updated doc here too: http://platform.xwiki.org/xwiki/bin/view/DevGuide/velocityHqlExamples#HGetti... Anyway last question about this query: is it possible to have doc info AND doc xwiki object class property value? Here field I want, if I use same query to select blog post of 'Blog.News' category, select distinct doc.fullName, doc.creationDate, Property.name.publishDate.value, Property.name.extract.value from XWikiDocument as doc, BaseObject as obj, DBStringListProperty as prop join prop.list list where obj.name=doc.fullName and obj.className='Blog.BlogPostClass' and obj.id=prop.id.id and prop.id.name='category' and list='Blog.News' order by doc.creationDate desc or I must use a loop over properties after query on each query result (doc.fullname)? thxs -------------------------------------------- En date de : Mar 3.11.15, Pascal BASTIEN <pbasnews-xwiki@yahoo.fr> a écrit : Objet: Re: [xwiki-users] Need help to find a hql query À: "Marius Dumitru Florea" <mariusdumitru.florea@xwiki.com>, "XWiki Users" <users@xwiki.org> Date: Mardi 3 novembre 2015, 12h00 Yes thxs (gdelhumeau helped me on irc). => I update doc: http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module I used wrong value like you found too :-) -------------------------------------------- En date de : Mar 3.11.15, Marius Dumitru Florea <mariusdumitru.florea@xwiki.com> a écrit : Objet: Re: [xwiki-users] Need help to find a hql query À: "Pascal BASTIEN" <pbasnews-xwiki@yahoo.fr> Date: Mardi 3 novembre 2015, 11h01 On Mon, Nov 2, 2015 at 5:15 PM, Pascal BASTIEN <pbasnews-xwiki@yahoo.fr> wrote: I didn't manage to use blog example on xwiki 7.0.1 (I replace 'XWiki.ArticleClass' by 'Blog.BlogPostClass' : we must fix doc if it is ok) The query example don't work (or maybe I don't know how to use it ;-) ) select distinct doc.fullName, doc.creationDate from XWikiDocument as doc, BaseObject as obj, DBStringListProperty as prop join prop.list list where obj.name=doc.fullName and obj.className='Blog.BlogPostClass' and obj.id=prop.id.id and prop.id.name='category' and list='${category}' order by doc.creationDate desc This works fine for me: select distinct doc.fullName, doc.creationDate from XWikiDocument as doc, BaseObject as obj, DBStringListProperty as prop join prop.list list where obj.name=doc.fullName and obj.className='Blog.BlogPostClass' and obj.id=prop.id.id and prop.id.name='category' and list='Blog.News' order by doc.creationDate desc You probably don't have the right value in $category. Hope this helps, Marius If I remove category parameter #set ($query ="select distinct doc.fullName, doc.creationDate from XWikiDocument as doc, BaseObject as obj, DBStringListProperty as prop join prop.list list where obj.name=doc.fullName and obj.className='Blog.BlogPostClass' order by doc.creationDate desc") the query return all doc with blog class -------------------------------------------- En date de : Lun 2.11.15, Marius Dumitru Florea <mariusdumitru.florea@xwiki.com> a écrit : Objet: Re: [xwiki-users] Need help to find a hql query À: "Pascal BASTIEN" <pbasnews-xwiki@yahoo.fr>, "XWiki Users" <users@xwiki.org> Date: Lundi 2 novembre 2015, 13h47 On Mon, Nov 2, 2015 at 1:00 PM, Pascal BASTIEN <pbasnews-xwiki@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#HGetti... 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#HQueryLang... . 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/xwik..., 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
I confirm: XWiki "is kind of magic": I read this example: http://xwiki.markmail.org/message/e2mi4odgpucsd3cu #set ($hql ="select distinct doc.fullName, otherprop.value, doc.creationDate from XWikiDocument as doc, BaseObject as obj, StringProperty otherprop, DBStringListProperty as prop join prop.list list where obj.name=doc.fullName and obj.className='Blog.BlogPostClass' and obj.id=prop.id.id and prop.id.name='category' and list='Blog.Autres' and obj.id=otherprop.id.id and otherprop.id.name='title' order by doc.creationDate desc") (must try with category property now) -------------------------------------------- En date de : Mer 4.11.15, Pascal BASTIEN <pbasnews-xwiki@yahoo.fr> a écrit : Objet: Re: [xwiki-users] Need help to find a hql query À: "Marius Dumitru Florea" <mariusdumitru.florea@xwiki.com>, "XWiki Users" <users@xwiki.org> Date: Mercredi 4 novembre 2015, 8h54 I updated doc here too: http://platform.xwiki.org/xwiki/bin/view/DevGuide/velocityHqlExamples#HGetti... Anyway last question about this query: is it possible to have doc info AND doc xwiki object class property value? Here field I want, if I use same query to select blog post of 'Blog.News' category, select distinct doc.fullName, doc.creationDate, Property.name.publishDate.value, Property.name.extract.value from XWikiDocument as doc, BaseObject as obj, DBStringListProperty as prop join prop.list list where obj.name=doc.fullName and obj.className='Blog.BlogPostClass' and obj.id=prop.id.id and prop.id.name='category' and list='Blog.News' order by doc.creationDate desc or I must use a loop over properties after query on each query result (doc.fullname)? thxs -------------------------------------------- En date de : Mar 3.11.15, Pascal BASTIEN <pbasnews-xwiki@yahoo.fr> a écrit : Objet: Re: [xwiki-users] Need help to find a hql query À: "Marius Dumitru Florea" <mariusdumitru.florea@xwiki.com>, "XWiki Users" <users@xwiki.org> Date: Mardi 3 novembre 2015, 12h00 Yes thxs (gdelhumeau helped me on irc). => I update doc: http://extensions.xwiki.org/xwiki/bin/view/Extension/Query+Module I used wrong value like you found too :-) -------------------------------------------- En date de : Mar 3.11.15, Marius Dumitru Florea <mariusdumitru.florea@xwiki.com> a écrit : Objet: Re: [xwiki-users] Need help to find a hql query À: "Pascal BASTIEN" <pbasnews-xwiki@yahoo.fr> Date: Mardi 3 novembre 2015, 11h01 On Mon, Nov 2, 2015 at 5:15 PM, Pascal BASTIEN <pbasnews-xwiki@yahoo.fr> wrote: I didn't manage to use blog example on xwiki 7.0.1 (I replace 'XWiki.ArticleClass' by 'Blog.BlogPostClass' : we must fix doc if it is ok) The query example don't work (or maybe I don't know how to use it ;-) ) select distinct doc.fullName, doc.creationDate from XWikiDocument as doc, BaseObject as obj, DBStringListProperty as prop join prop.list list where obj.name=doc.fullName and obj.className='Blog.BlogPostClass' and obj.id=prop.id.id and prop.id.name='category' and list='${category}' order by doc.creationDate desc This works fine for me: select distinct doc.fullName, doc.creationDate from XWikiDocument as doc, BaseObject as obj, DBStringListProperty as prop join prop.list list where obj.name=doc.fullName and obj.className='Blog.BlogPostClass' and obj.id=prop.id.id and prop.id.name='category' and list='Blog.News' order by doc.creationDate desc You probably don't have the right value in $category. Hope this helps, Marius If I remove category parameter #set ($query ="select distinct doc.fullName, doc.creationDate from XWikiDocument as doc, BaseObject as obj, DBStringListProperty as prop join prop.list list where obj.name=doc.fullName and obj.className='Blog.BlogPostClass' order by doc.creationDate desc") the query return all doc with blog class -------------------------------------------- En date de : Lun 2.11.15, Marius Dumitru Florea <mariusdumitru.florea@xwiki.com> a écrit : Objet: Re: [xwiki-users] Need help to find a hql query À: "Pascal BASTIEN" <pbasnews-xwiki@yahoo.fr>, "XWiki Users" <users@xwiki.org> Date: Lundi 2 novembre 2015, 13h47 On Mon, Nov 2, 2015 at 1:00 PM, Pascal BASTIEN <pbasnews-xwiki@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#HGetti... 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#HQueryLang... . 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/xwik..., 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 _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
Hi All, actually i use a multi-select user-list as parameter on a class for all objects-instances. Now in need to add a value to any selected user which is in the list in the object. You have any idea how i can solve that in a good way? Example: Class: Skill Object 1: Skill A User-Selection in Object 1: User X, User Y Object 2: Skill B User-Selection in Object 2: User X, User Z Now i need the competence-level for every user on every skill, so i need something like User-Selection in Object WITH level: User X (Level 2), User Y (Level 3) This information is by definition in a Matrix, so somewhere i need to attach it. Maybe i need to create a custom class and use there user and skill. What do you think? Can you help me? Regards, Matthias
participants (2)
-
Matthias Wegner -
Pascal BASTIEN