select count(*) as classcount form whowhat where whatever=whatever ----- Original Message ----- From: Tino Wildenhain <tino@wildenhain.de> To: <zope@zope.org> Sent: Saturday, March 11, 2000 12:08 PM Subject: Re: [Zope] Simple Count Method (even simpler ;) Curtis Maloney wrote:
On Fri, 10 Mar 2000, Joseph A. Archer wrote:
To all Zopist,
(I am new to the list, and yes I am going through the archives for the answer, but haven't found it yet.)
I have a simple two field table in MySQL, "whowhat", that pulls a user id from one table, and a class code from another. (It tells you "who" has "what" classes)
I , being somewhat new to python & Zope, am having the darndest time trying to do a simple external method to do a count of how many times the class "so-and-so" is in the table. (That way, I know how many people have signed-up, and how close I am to the class max.) I have tried different searches. I have an SQL Method that does:
select * from whowhat
And I also have one that does:
... sselect * from whatwhat where classcode = <dtml-sqlvar class_name type=nb>
I've been trying to create an External Method, but I just can't seem to get it to work. (yes, in the Extentions directory)
I need to try to stay away from doing a "select count(classcode)..." in an SQL Method if I can.
Any help to this tormented soul would be greatly appreciated.
Greetings,
In my experience, to count the size of an array in ZOPE does not require an external method, simply "_.len(sqlQuery())". I use this myself in a few places.
I won't try to guess your reasons for not getting sql to count, but surely it would be by far the simplest way?
How about <dtml-in sqlQuery> <dtml-var sequence-lenght> </dtml-in> ? There also some more statistics over the columns. Please refer to the manual for more. Best regards Tino Wildenhain _______________________________________________ Zope maillist - Zope@zope.org http://lists.zope.org/mailman/listinfo/zope ** No cross posts or HTML encoding! ** (Related lists - http://lists.zope.org/mailman/listinfo/zope-announce http://lists.zope.org/mailman/listinfo/zope-dev )