Re: how to accumulate data using ZPT
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@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
sorry for the last mail. it was a simple tag order mistake . final version is : <span tal:condition="not:penaltylen" tal:content="python:penalty[0].unit_cost"/> <span tal:define="global sum python:sum+penalty[0].unit_cost"/> <tr><td><b>Total <td><b tal:content="sum"></b></td></tr> plz be in touch it'll good for this newbie. thanks again On 5/20/05, prabuddha ray <buddharay@gmail.com> wrote:
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@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
-- Share the vision of difference with ME
participants (1)
-
prabuddha ray