Terry (and everyone else, of course :), I think the following thread (which is currently happening on the user list) demonstrates that there are some _basic_ things missing. This time it's the lack of Number-Support. Such things are basicly the reason why I so often tried to push the development or the discussion. Users can't imagine, that their template-language would not know anything about floats, or that #parse'd macros do not function properly or that macros cannot be overloaded or that whitespace-handling is so hard... If you are an experienced Velocity-User, then you probably have written some tools to overcome some of these "shortcommings". Velocity is good (no question) but it could be imroved significantly. (i.e. _has to_ IMHO).
So, any suggestions on how to get the project working again? Geir, are you still listening? What's you opinion on all that? Peter -----Original Message----- From: pero [mailto:[EMAIL PROTECTED] Sent: Monday, March 03, 2003 7:40 PM To: 'Velocity Users List' Subject: RE: Running total A Tool is nothing but an Object you put into the Context. For your purpose you could write something like: public class MyTotal { private float value; public void add (double number) { this.value += number; } public float getValue() { return this.value; } } Then simply create an object of it and put it into your context and use it like (assuming that you put it into the context under the key 'amt_total'): #foreach (... ... $amt_total.add($row.prior_payment_amount) ... #end And print the value: $amt_total.value Hope that helps, Peter ..: Most people refer to the term "Tool" as a set of highly reusable methods. There is also a Velocity-Tool-Subproject where people put together some useful tools. Documentation (not much) can be found under: http://jakarta.apache.org/velocity/toolsubproject.html > -----Original Message----- > From: Leyzerzon, Simeon G [mailto:[EMAIL PROTECTED] > Sent: Monday, March 03, 2003 7:26 PM > To: 'Velocity Users List' > Subject: RE: Running total > > > Thank you, Peter > > What is a Tool? > > Is there a reference for it? > > Simeon > > > > -----Original Message----- > From: pero [mailto:[EMAIL PROTECTED] > Sent: Monday, March 03, 2003 1:23 PM > To: 'Velocity Users List' > Subject: RE: Running total > > > Simeon, > > > > > > > > > The line: > > > > > > > > > > > > #set($prior_payment_amt_total = $prior_payment_amt_total + > $row.prior_payment_amount)## > > > > > > > What is the type of $row.prior_payment_amount? I think it's a float or > > a double. If so, then you cannot do it this way since > Velocity can only > > compute Integer-values (until now). So you'd have to > calculate the total > > within one of your beans or you could use a Tool... > > > > Sorry for the bad news :( > > > > Peter > > > > > > > > Thanks. > > > > > > Simeon > > > > > > -----Original Message----- > > > From: pero [mailto:[EMAIL PROTECTED] > > > Sent: Monday, March 03, 2003 12:49 PM > > > To: 'Velocity Users List' > > > Subject: RE: Running total > > > > > > > > > I do not fully understand your question, but if you add an Integer > > > > > > to the context it stays an Integer unless you reassign its name > > > > > > with a String. It would be nice, if you could provide some > > > sample code. > > > > > > > > > > > > Peter > > > > > > > > > > > > > -----Original Message----- > > > > > > > From: Leyzerzon, Simeon G [mailto:[EMAIL PROTECTED] > > > > > > > Sent: Monday, March 03, 2003 6:46 PM > > > > > > > To: Velocity Users List (E-mail) > > > > > > > Subject: Running total > > > > > > > > > > > > > > > > > > > > > Is it possible to do a running total on a numeric field in > > > > > > > the velocity > > > > > > > template? > > > > > > > I'm assuming that after the merge everything is just a > > > > > > > String. How would I > > > > > > > reconvert the numbers back to do the total? > > > > > > > Thank you. > > > > > > > Simeon > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > > > > To unsubscribe, e-mail: > [EMAIL PROTECTED] > > > > > > > For additional commands, e-mail: > > > [EMAIL PROTECTED] > > > > > > > > > > > > > > > > > > > > > > > > > > --------------------------------------------------------------------- > > > > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > > > > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: > [EMAIL PROTECTED] > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
