velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kishore Senji <>
Subject Re: Can I perform math operations on longs with the #set() directive?
Date Sat, 09 Oct 2004 23:04:02 GMT
Use Math Tool.

On Sat, 09 Oct 2004 16:59:06 +0100,
<> wrote:
> Hi all,
> I'm using velocity to generate mails based on several templates.
> I hava an application that stores certain information in *longs* (such as duration in
seconds and storage space in bytes).
> I'd like to send emails with this information, but I'd like to convert it to different
units for readability purposes (bytes to Mb or Gb, and seconds to days). It nakes sense to
do this in the template (presentation layer), because if someone wants to have a diferent
kind of unit they can change the template (which is stored in the DB) and I don't have to
rebuild and redeploy the whole project.
> I'd like to do something like #set($storage_mb = $storage_bytes/(1024*1024)) but, unfortunantlly
the #set() directive only allows operations in integers.
> Can someone sujest another way to do this in the template?
> --
> Thanx
> Pedro Pires
> ________________________________________________________________________________
> A protecção do e-mail contra vírus é cada vez mais necessária!
> Proteja a sua Caixa de Correio:
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message