Okay, so having a bit of difficulty with this...
I have a space 'Peoples', with a class/sheet/template associated with it.
I can create a new instance of this object, and it is created in the
'People' space, that's all fine and dandy...
In this class there is a property 'location', that is a static list, single
selection only in a drop down box.
For example's sake, I'll say there are 3 locations, 'X', 'Y',
'Z'.
On the 'Peoples' space's main page, where a user may create a new instance,
or see a list of already created 'People', I'm trying to create this list
divided by the three locations.
I tried to calculate the number of 'People' instances with the location
'X'
in the following manner:
#set ($whereClauseX = "obj.name=doc.fullName and
obj.name<>'Peoples.PeopleClassTemplate' and
obj.className='Peoples.PeopleClass' and prop.id.id = obj.id and
prop.id.name='location' and prop.value='X' order by doc.creationDate
desc")
#set ($numX = "select count(distinct doc) from XWikiDocument doc, BaseObject
as obj, LargeStringProperty as prop where $whereClauseX")
Now, I know there are instances of 'People' objects in this space that have
the value 'X' for the 'location' property, but whenever I access this
variable, it is always being calculated as 0.
Can someone point out my problem with that block of code?
Also, this affects my later code I think as, when it hits the following
block of code, nothing appears on screen, and I get some errors in the
Tomcat screen. Code:
#if ($numX > 0)
<h3>Location X:</h3>
#set ($sql = ", BaseObject as obj, LargeStringProperty as prop where
$whereClauseX")
#set($bentrydoc = $xwiki.getDocument($item))
#set($bentryobj = $bentrydoc.getObject("Peoples.PeopleClass",
"language",
$language, true))
#foreach ($item in $xwiki.searchDocuments($sql))
* [${bentrydoc.display("first_name","view",$bentryobj)}
${bentrydoc.display("last_name","view",$bentryobj)}|$item]
#end
#end
And the Tomcat error(s):
WARNING: Parameters: Invalid chunk ignored.
[ERROR] Left side of '>=' operation is not a Numbere. Peoples.WebHome [line
82, column 15]
However, no where in my code am I using the operator '>='...
Any kind person with a helping hand would be appreciated. Thanks again
community!
--
View this message in context:
http://n2.nabble.com/Help-with-Velocity-HQL-query-tp1372223p1372223.html
Sent from the XWiki- Users mailing list archive at
Nabble.com.