Jonathan's approach worked with a small change $Integer.parse should be $Integer.parseInt
It's good to know about Velocity tools. I wanted to see which tools are included with Velocity by default, but the link to "The default configuration provided for GenericTools is here" is broken on this page http://velocity.apache.org/tools/devel/generic.html#Tools Thanks, Alec On Wed, Aug 24, 2011 at 2:08 PM, Nathan Bubna <nbu...@gmail.com> wrote: > No, but there's plenty of ways to convert it. Jonathan's > $Integer.parse($x) is simple. VelocityTools has a ConversionTool or > MathTool that both can handle the conversion. Or you can just use the > MathTool to do the subtraction and it will automatically convert > strings or other objects. > > On Wed, Aug 24, 2011 at 12:51 PM, Alec Swan <alecs...@gmail.com> wrote: >> Ah, looks like $x type is a string even though it represents a number. >> Is there any type casting in Velocity? >> >> On Wed, Aug 24, 2011 at 1:46 PM, Nathan Bubna <nbu...@gmail.com> wrote: >>> what are the types of $x and $a.func("$z") ? >>> >>> subtraction only works on java.lang.Number (or primitive counterparts) >>> or objects that implement Velocity's TemplateNumber interface. >>> >>> On Wed, Aug 24, 2011 at 12:33 PM, Alec Swan <alecs...@gmail.com> wrote: >>>> Hello, >>>> >>>> I am having problems with getting the following expression to work >>>> correctly: >>>> #set($var = $x - $a.func("$z"))${var} >>>> >>>> Note that the following expressions work properly: >>>> #set($var = $x)${var} >>>> #set($var = $a.func("$z"))${var} >>>> >>>> However, subtraction does not seem to return the expected result. >>>> >>>> Thanks, >>>> >>>> Alec >>>> >>>> --------------------------------------------------------------------- >>>> To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org >>>> For additional commands, e-mail: user-h...@velocity.apache.org >>>> >>>> >>> >>> --------------------------------------------------------------------- >>> To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org >>> For additional commands, e-mail: user-h...@velocity.apache.org >>> >>> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org >> For additional commands, e-mail: user-h...@velocity.apache.org >> >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org > For additional commands, e-mail: user-h...@velocity.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@velocity.apache.org For additional commands, e-mail: user-h...@velocity.apache.org