I'm still having some problems with converting variables to integers so I can perform 
operations on/with them.  (I've got some complex displays.)  In this particular case, 
my Java code is doing a context.put() of a vector of vectors, each of which holds 
several objects, one of which is an Integer object.  The reference (at the VTL level, 
inside the #foreach($entry in $entries) directive) is $entry.elementAt(0).Price.  It 
displays fine, but if I try to do any operations on it (adding, multiplying, etc.), 
the result is (apparently) null.  I've tried $int.valueOf($entry.elementAt(0).Price), 
but that has the same outcome.  I've gone over both the user and dev docs again and 
find only a mention that you must use integers.

In other words, in the template:

  #set($charge = 1 * $int.valueOf($entry.elementAt(0).Price)) does *not* work.
  #set($charge = $int.valueOf($entry.elementAt(0).Price)) does *not* work
  #set($charge = $entry.elementAt(0).Price) works, in the sense that it's value is not 
null.

Please give me some idea of how to handle this stuff without introducing too much 
logic into the template and I'll be happy to write it up for others.

Regards,

Terry

PS: Someone suggested my earlier question would better fit into the users' (rather 
than developers') group.  I'm staying with the developer's list because these 
questions seem to be deeper than template editing (but admittedly more specific and 
pragmatic than deep 'inner guts' stuff).



Reply via email to