Numbers in XWiki documents

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Numbers in XWiki documents

jjanssen
Hello,

I've created an class with a property defined as a number. Hower, when I retrieve an object in my XWiki document, $doc.display("property", "view", $obj) will return me a String. This prevents my from adding the property values of several objects.

So how to retrieve an number property as a number in a XWiki document.

Thanks,

Joep Janssen



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Numbers in XWiki documents

Ludovic Dubost

Hi Joep,

The displayer has the objective of getting the "html" output of the field.
To get the actual value you should use

$obj.getProperty("property").getValue()

It should return you an Integer object (or Long or Double)

$obj.getProperty("property").getValue().intValue()
should give you an 'int'

Be carefull because velocity only handles 'int' for calculations

Ludovic


[hidden email] a écrit :

> Hello,
>
> I've created an class with a property defined as a number. Hower, when I retrieve an object in my XWiki document, $doc.display("property", "view", $obj) will return me a String. This prevents my from adding the property values of several objects.
>
> So how to retrieve an number property as a number in a XWiki document.
>
> Thanks,
>
> Joep Janssen
>
>  
> ------------------------------------------------------------------------
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>  

--
Ludovic Dubost
XPertNet: http://www.xpertnet.fr/
Blog: http://www.ludovic.org/blog/
XWiki: http://www.xwiki.com
Skype: ldubost AIM: nvludo Yahoo: ludovic




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Re: Numbers in XWiki documents

jjanssen
Thanks,

That was it!

Joep



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws