Hi Tino, the problem I see with your (I agree: much cleaner) code is that for each group you issue a SQL statement. So if I have 1000 groups you'll end up with 1000 SQL queries. In my (ugly :-) code you'd only have 2 sql queries: - the first one: sqlCount (see previous post) - the second (cached) one outside the iterations: DATA=sqlListProjects (large list with 1000*Projects rows). About the caching: I read that in Dieter's Zope Book: http://www.dieter.handshake.de/pyprojects/zope/book/chap3.html So my question remains: is there either DATA[1:a+b] (both a and b are dtml-Variables) possible or <dtml-in .. start=a+b..> (both a and b are dtml-Variables). Thanks again, Philipp -----Ursprüngliche Nachricht----- Von: Tino Wildenhain Gesendet: So 27.5.2001 17:38 An: Philipp Robbel Cc: zope@zope.org Betreff: Re: dtml-Variablen in <dtml-in> loops? First of all, you dont have to cache SQL results via dtml-let. Zope does this already for you. If you have 2 queries: sqlGroupList: SELECT DISTINCT GroupID FROM Projects and the other: sqlProjectList(arg_GroupID) SELECT ProjectID, Project FROM Projects WHERE GroupID=<dtml-arg_GroupID type=int> so you can: <dtml-in sqlGroupList> GroupID &dtml-GroupID;: <dtml-in "sqlProjectList(arg_GroupID=GroupID)"> <dtml-unless sequence-start>,</dtml-unless> <dtml-var Project> </dtml-in> </dtml-in> This looks a bit cleaner imho ;) Regards Tino Wildenhain