Re: [ZIZope] Calculate a sum of values with dtml

Claudio Battaglino <[email protected]> Mon, 17 Dec 2007 10:02:43 +0100
Newsgroups gmane.comp.web.zope.italian
Message-ID <[email protected]>
Mauro Ziliani ha scritto:
> Hi all.
> My answer is: is it possible to make a sum of a sequence of numbers 
> with dtml?
> That is: I have a result of a ZSQL method which a field is a 
> floating-point data.
> I would like to do that
>
> <dtml-in sql_sequence>
> ... total calculation in some manner...
> </dtml-in>
>
> <dtml-var total_is fmt="%.2f">
>
> Any idea?
>
> Thanks to all
>
>   
Perché non usi uno script che fa la somma dei numeri?

<dtml-let sequence="[3,5,6]">
<dtml-var expr="somma(sequence)">
</dtml-let>


script somma:
somma = 0
for x in lista:
  somma=somma + x
return somma


cld

_______________________________________________
Zope mailing list
[email protected]
http://lists.zope.it/cgi-bin/mailman/listinfo/zope