[Zope] looping through

Russell Hires rhires@earthlink.net
Fri, 31 Aug 2001 08:04:11 -0400


Hello everyone,

I also sent this to the zope-db list, which I found from the Zope News...but 
I thought I'd go ahead and post this here as well, since the readership on 
that list is likely to be quite small since it's a new list, with only 6 
messages on it...

I'm working on a gradebook program for (using an SQL db adapter)
teachers, and at this point I want a teacher to be able to add an assignment. 
I've got a basic table that has the student name, id, assignment, and grade, 
with a row for each assignment/grade for each student. I'm at the point now 
where the teacher adds a new assignment and I want <something> to go through 
the table, and create new rows for each student, but with a null value for 
the grade which will be entered later. How do I do that? I'm thinking of just 
going through the table with a SELECT DISTINCT student-id clause (that way I 
only create the rows once for each student assignment), but that seems like 
two steps, one for the SELECT DISTINCT, but then adding new rows based on 
that query is baffling me. 

Thanks for the help!

Russell