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
[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]>  

[EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> 
www.gemalto.com <http://www.gemalto.com> 
 

 

 

 

 

<<image001.jpg>>

_______________________________________________
users mailing list
users@xwiki.org
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to