[Zope] Re: totalling variables

Maik Jablonski maik.jablonski@uni-bielefeld.de
Thu, 03 Apr 2003 10:05:50 +0200


mehmety wrote:
> Hello, this should be a simple one but.....
> I've got a setup like
> <dtml-in some-sql-query>
>    <dtml-in some-other-sql-query-that-uses-an-argument-from-first>
>    </dtml-in>
> </dtml-in>
> the second dtml-in gets a total of some products relating to the first 
> dtml-in. I want to total up
> all the iterations

Hi,

I would do it this way...

<dtml-call "REQUEST.set('total_balance',0)">
<dtml-in some-sql-query>
    <dtml-in some-other-sql-query-that-uses-an-argument-from-first>
    <dtml-call "REQUEST.set('total_balance',total_balance+balance)">
    </dtml-in>
</dtml-in>

Cheers, Maik