<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
  <title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<br>
What r those "penaltylen" and "penalty"? and also can u tell us y u r
checking&nbsp; "not:penaltylen"?<br>
<br>
regards,<br>
Deepak<br>
<br>
prabuddha ray wrote:
<blockquote cite="mid815f70cf05052401175c6c34cf@mail.gmail.com"
 type="cite">
  <pre wrap=""> ok this is again freaky on my part.

my problem still remains intact .as i've told earlier,
in my ZPT I needed to find a way to sum up column values 
if they are present and print the total at the last row.

I tried this as a Deepak pal tipped :

&lt;span tal:condition="not:penaltylen" tal:content="python:penalty[0].unit_cost"/&gt;
        &lt;span tal:define="global sum python:sum+penalty[0].unit_cost"/&gt;
 &lt;tr&gt;&lt;td&gt;Total &lt;td&gt;&lt;b tal:content="sum"&gt;&lt;/b&gt;&lt;/td&gt;&lt;/tr&gt;

 but what happens is obvious , for reports where even one row has the
unitcost missing followiing error comes up:

"tuple indx out of range"

when i changed tghe span tgs alike this :

&lt;span tal:condition="not:penaltylen" tal:content="python:penalty[0].unit_cost"&gt;
        &lt;span tal:define="global sum python:sum+penalty[0].unit_cost"/&gt;
&lt;/span&gt;

no error was there but the total remained 0.

No ZSQLmethod can be used to get the sum coz its pretty complex.

 so plz rethink the code I'm also trying hard.
 hope for a reply soon
 
  </pre>
  <blockquote type="cite">
    <pre wrap="">On 5/20/05, Deepak <a class="moz-txt-link-rfc2396E" href="mailto:dgangadhar@zeomega.com">&lt;dgangadhar@zeomega.com&gt;</a> wrote:
    </pre>
    <blockquote type="cite">
      <pre wrap="">Hi Prabuddha,
   
check this ...

&lt;span tal:define="global sum python:0"/&gt;
&lt;span tal:repeat="item python:here.somesql()"&gt;
    &lt;span tal:condition="item/var" tal:define="global sum 
python:sum+item.var"/&gt;
&lt;/span&gt;
&lt;span tal:content="sum"/&gt;        

thanks,

Deepak

prabuddha ray wrote:

      </pre>
      <blockquote type="cite">
        <pre wrap="">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.



On 5/20/05, Tino Wildenhain <a class="moz-txt-link-rfc2396E" href="mailto:tino@wildenhain.de">&lt;tino@wildenhain.de&gt;</a> wrote:
 

        </pre>
        <blockquote type="cite">
          <pre wrap="">Am Freitag, den 20.05.2005, 10:36 +0100 schrieb Hugo Ramos:
   

          </pre>
          <blockquote type="cite">
            <pre wrap="">On 5/20/05, Tino Wildenhain <a class="moz-txt-link-rfc2396E" href="mailto:tino@wildenhain.de">&lt;tino@wildenhain.de&gt;</a> wrote:
     

            </pre>
            <blockquote type="cite">
              <pre wrap="">Am Freitag, den 20.05.2005, 09:52 +0100 schrieb Hugo Ramos:
       

              </pre>
              <blockquote type="cite">
                <pre wrap="">Yellow,

What DBMS are you using??? MySQL???
If so just have a sql method do this:
==========
SELECT COUNT( '*' )  AS total
                </pre>
              </blockquote>
              <pre wrap="">&gt;FROM yourtable
              </pre>
              <blockquote type="cite">
                <pre wrap="">==========
         

                </pre>
              </blockquote>
              <pre wrap="">Are you sure about the ' '? looks strange.
       

              </pre>
            </blockquote>
            <pre wrap="">It works both ways... With or without the ' ' !

     

            </pre>
          </blockquote>
          <pre wrap="">well. another reason to avoid mysql I guess ;)




   

          </pre>
        </blockquote>
        <pre wrap="">
 

        </pre>
      </blockquote>
      <pre wrap="">

      </pre>
    </blockquote>
  </blockquote>
  <pre wrap=""><!---->

  </pre>
</blockquote>
<br>
</body>
</html>