Am Freitag, den 20.05.2005, 09:52 +0100 schrieb Hugo Ramos:
> Yellow,
> 
> What DBMS are you using??? MySQL???
> If so just have a sql method do this:
> ==========
> SELECT COUNT( '*' )  AS total
> FROM yourtable
> ==========

Are you sure about the ' '? looks strange.

> Then call the variable total where you need it!
> 
> Regards
> hr
> 
> 
> On 5/20/05, prabuddha ray <[EMAIL PROTECTED]> wrote:
> > I've this report wherein i've to print the column total iin last row.
> > column values are from database.
> > so far I'm a total loss. do i need to have cookies to store this total?

simplest solution if you need the data anyway:
a python script where you do the zsql method

results=context.whateverZSQLMethod(args...)

return context.yourPageTemplate(results=results,count=len(results))

and use

tal:content="options/count" in the template where you need count.
If its a sum you need, just work over your resultset or use a separate
query. 

Easiest to work over result set (especially if the select is costy)


results=context.whateverZSQLMethod(args...)

total=0
for item in results:
   if item.value: # this handles the case of nulls
       total+=item.value

and use the total as argument:

return context.yourPageTemplate(results=results,
                                count=len(results),
                                total=total)


-- 
Tino Wildenhain <[EMAIL PROTECTED]>

_______________________________________________
Zope maillist  -  Zope@zope.org
http://mail.zope.org/mailman/listinfo/zope
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope-dev )

Reply via email to