[Zope] DTML newbie question on summation

Marcus Collins mcollins@sunesi.com
Fri, 2 Jun 2000 15:49:38 +0200


Hi!

> -----Original Message-----
> From: Coleman, Bryan [mailto:bcoleman@questcon.com]
> Sent: 02 June 2000 15:20
> To: 'zope@zope.org'
> Subject: [Zope] DTML newbie question on summation
> 
> 
> I can't seem to add variables using let. I just get a 
> concatination of the integers. I am using ...
> 
> <dtml-let total="SUNDAY + MONDAY + TUESDAY + WEDNESDAY + 
> THURSDAY + FRIDAY + SATURDAY">
> 
> The days represent hours but are stored as integers in the database.

While they're stored as integers, some of the database adaptors return
everything as strings. This would seem to be borne out by the concatenation.

Try: 

<dtml-let total="_.int(SUNDAY) + _.int(MONDAY) + _.int(TUESDAY) +
_.int(WEDNESDAY) + _.int(THURSDAY) + _.int(FRIDAY) + _.int(SATURDAY)">

to explicitly convert your results to integers.

hth,

-- Marcus