"Benedetto, Kristina (CAP, TIP)" wrote:
> 
> I have vector of vectors that I am using $data.elementAt(3) within a for loop in a 
>template to get the values out. At the same time I need to accumulate totals for 
>these values.

Vectors of vectors of what?  That might be important here.

> After putting context.put( "int", new Integer(1) ); in the servlet, I have attempted 
>to use:
> #set($total = int.valueOf($total) +$int.valueOf($data.elementAt(3)))
> The $total variable doesn't get populated and is presented as $total.

Right - first think I would do is make sure that it's initialized.  The
whole thing is going to fail if $total hasn't be set to anything ever. 
A simple

#set($total = 0)

will suffice.
 
> Is it possible to accumulate totals this way and maybe my syntax is incorrect? Is 
>there a better way of accumulating values within a template?


Tell us what are held by the 'inner' vectors....

geir

-- 
Geir Magnusson Jr.                           [EMAIL PROTECTED]
System and Software Consulting
Developing for the web?  See http://jakarta.apache.org/velocity/
"still climbing up to the shoulders..."

Reply via email to