Ok maybe I need a new set of eyes, but the following works and returns all
the toolbar documents...
#set ($hql = ", BaseObject as obj,
StringProperty prop
where obj.name=doc.fullName and obj.className='XWiki.ToolbarClass' and
obj.name<>'XWiki.ToolbarClassTemplate' and
obj.id=prop.id.id")
The ToolbarClass has a Number Property called 'Order' but this doesn't
work...
#set ($hql = ", BaseObject as obj,
StringProperty prop
where obj.name=doc.fullName and obj.className='XWiki.ToolbarClass' and
obj.name<>'XWiki.ToolbarClassTemplate' and
obj.id=prop.id.id and
prop.id.name='Order'")
Erin Schnabel-3 wrote:
Hi,
I am querying for all the users whose addresses are matching a
particular pattern. (there is an "address" property in the UserClass).
Also I want to the results to be sorted by another property, "username".
I found a similar query in this mailing list thread :
http://www.nabble.com/select-objects-by-class-and-sort-by-property-tf710844…
I tried forming the following query but it is wrong.
, BaseObject as obj, StringProperty as prop, StringProperty as otherprop
join obj.id=otherprop.id.id and otherprop.id.name='username' where
obj.name=doc.fullName and obj.className='Users.UserClass' and
obj.id=prop.id.id and prop.id.name='address' and prop.value like
'%someaddress%' order by otherprop.value
Can anyone tell me what the correct query should be like.
Thanks in advance
Roopesh
------------------
DigitalGlue, India
You have the .id.id matching happening a little inconsistently. I've seen
this work:
, BaseObject as obj,
StringProperty as prop,
StringProperty as otherprop
where
(obj.name=doc.fullName and obj.className='Users.UserClass') AND
(obj.id=prop.id.id and prop.id.name='address' and prop.value like
'%someaddress%') AND
(obj.id=otherprop.id.id and otherprop.id.name='username')
order by otherprop.value
I stick parens in there for sanity's sake. I can always tell when I'm
working with one property vs. the other because of visual grouping. But
that's just me... ;)
Erin
--
Waste of a good apple. --Samwise Gamgee
--
You receive this message as a subscriber of the xwiki-users(a)objectweb.org
mailing list.
To unsubscribe: mailto:xwiki-users-unsubscribe@objectweb.org
For general help: mailto:sympa@objectweb.org?subject=help
ObjectWeb mailing lists service home page:
http://www.objectweb.org/wws
--
View this message in context:
http://www.nabble.com/Order-by-property-of-a-class-tp11559782p17457718.html
Sent from the XWiki- Users mailing list archive at
Nabble.com.