[xwiki-users] [1.1] Velocity, summing properties

BOUSQUET Jeremie Jeremie.BOUSQUET at gemalto.com
Thu Aug 30 16:01:02 CEST 2007


Hello,

 

I would like to perform a sum in a velocity script.

The following works well:

#set ($a = 1)

#set ($b = 1)

#set ($c= $a + $b)

 

$c returns 2

 

But if I modify with

#set ($b = $categoryDoc.getObject("Blog.Categories","name",$bcategory).get("color_red"))

 

... the sum does not work anymore. It seems that $b is considered as a string and gets appended to $a instead of added. The property retrieved "color_red" is of type Number.

 

Is there a way to convert it in order to perform arithmetics on it ? I looked at velocity dev guide but I'm quite confused ...

 

Thanks,

 

BOUSQUET Jeremie

GGS Europe Solution CMO & PMO
Gemalto

Tel: +33 4 42 36 42 93

Avenue du Jujubier Z.I. Athélia IV BP 90
13705 LA CIOTAT CEDEX
jeremie.bousquet at gemalto.com <mailto:jeremie.bousquet at gemalto.com>  

cmo-gse at gemplus.com <mailto:cmo-gse at gemplus.com> 
www.gemalto.com <http://www.gemalto.com> 
 

 

 

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.xwiki.org/pipermail/users/attachments/20070830/6108e1a7/attachment.htm 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/jpeg
Size: 2378 bytes
Desc: image001.jpg
Url : http://lists.xwiki.org/pipermail/users/attachments/20070830/6108e1a7/attachment-0001.jpe 
-------------- next part --------------
_______________________________________________
users mailing list
users at xwiki.org
http://lists.xwiki.org/mailman/listinfo/users


More information about the users mailing list