Hmm, running on dusty memory, away from my server atm but if I recall right, 
use $xwiki.parseInt($b) when you do calculations on it, assuming it's an int

________________________________

From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of BOUSQUET Jeremie
Sent: 30 August 2007 15:01
To: XWiki Users
Subject: [xwiki-users] [1.1] Velocity, summing properties



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
[email protected]
http://lists.xwiki.org/mailman/listinfo/users

Reply via email to