[Zope] Re: how to accumulate data using ZPT

prabuddha ray buddharay at gmail.com
Sat May 21 02:16:21 EDT 2005


thanks that was creative and justified. BUT it didnt work.
the total is still 0.

 here is what i did.

<div tal:define="unit_cost python:penalty[0].unit_cost; global sum python:0"
         tal:condition="not:penaltylen" tal:content="unit_cost" >
         <span tal:define="global sum python:sum+unit_cost"></span>
  </div>
 <tr><td <b>Total
<td ><b tal:replace="sum"></b></td></tr>

please tip me where I'm going wrong



On 5/20/05, Deepak <dgangadhar at zeomega.com> wrote:
> 
> Hi Prabuddha,
>    
> check this ...
> 
> <span tal:define="global sum python:0"/>
> <span tal:repeat="item python:here.somesql()">
>     <span tal:condition="item/var" tal:define="global sum 
> python:sum+item.var"/>
> </span>
> <span tal:content="sum"/>        
> 
> thanks,
> 
> Deepak
> 
> prabuddha ray wrote:
> 
> >sorry for delay, 
> >         but the options you gave are ruled out.
> >actually not all the rows in the column have the values.
> >further the total i'm looking for will result in a very complex query 
> >that i dont want to do onsidering the no. of rows are high.
> >          
> >  I just need something like a var in my ZPT which can just sum up the
> >values if they  are present.
> >value's prsence i'm checking using tal:condition but how to add the
> >value repeatedly in the sum var.
> >
> >kindly help.
-- 
Share the vision of difference with ME


More information about the Zope mailing list