BrianJones wrote:
> 
> Sergiu Dumitriu-2 wrote:
>> --- = -1
>> False = 0
>> True = 1
>>
>> And to answer another of your questions, --- means something like
>> unselected, not answered, neither. I know it doesn't quite fit in the
>> boolean logic, but otherwise there's no way of having neither true nor
>> false for a field.
>>
> 
> Thanks for your reply Sergiu, this helps clarify things, however....
> 
> 
> Sergiu Dumitriu-2 wrote:
>> #if (!$object.getProperty("example_bool").value == 1)
>>
> 
> I tried this method as you suggested, and got the same result as the
> original, the 'True' count is still representing all the objects found with
> the HQL query, and the 'False' count remains at zero.  I also tried this:
> 
> #if ($object.getProperty("example_bool").value == 0)
> 
> When I tried this, I got the same result on the page, it rendered, and the
> 'True' count represents all the objects, while the 'False' count remains at
> zero, BUT, I get an error in the Tomcat window:
> 
> [ERROR] Left side ($object.getProperty("example_bool").value) of '=='
> operation has null value. If a reference, it may not be in the context.
> Operation not possilbe. ExampleSpace.ExamplePage [line 90, column 56]
> 
> So obviously I'm doing something wrong still.  The syntax I'm using seems to
> be correct, can anyone point me in the right direction?  This is
> frustrating, as it seems that testing the value of a boolean property should
> be relatively easy.
> 
> Thanks again.
> 

Yes, I read the whole snippet again. The problem is that $object is not
an object, but a document. You must replace:

#set ($object = $xwiki.getDocument(${item}))

with

#set($object =
$xwiki.getDocument(${item}).getObject('Example.ExampleClass'))

-- 
Sergiu Dumitriu
http://purl.org/net/sergiu/
_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to