wait... there is a better/faster way

students=db((db.students.id==db.studentsections.userid)&
(db.sections.id==db.studentsections.sectionid)&
(db.studentsections.sectionid==id)&
(db.students.nowenrolled=='Y')).select(db.students.ALL,
orderby=db.students.fullname,
groupby=db.stduents.id)

Massimo

On Dec 4, 11:24 am, mdipierro <[EMAIL PROTECTED]> wrote:
> I think what you call a sqlset is a SQLRows. That is immutable. I
> believe you want to do
>
> db(qallstudents&(db.student.id.belongs(db(qenrolled)._select
> (db.students.id))).update(somefield=' ')
>
> or
>
> for student in db(qallstudents&(db.student.id.belongs(db
> (qenrolled)._select(db.students.id))).select():
>      # do something with student
>
> On Dec 4, 11:05 am, mattynoce <[EMAIL PROTECTED]> wrote:
>
> > hi, i'm a newbie to web2py but i'm very intrigued. the issue i'm
> > having is that i'd like to associate information with rows of a
> > sqlset.
>
> > for example, i am creating a page that enrolls/unenrolls users
> > (students) in a program (section). i want to list the students in the
> > section, then list all students (including the enrolled students) for
> > selection purposes. and in that bottom area, i want the enrolled
> > students to be marked somehow.
>
> > i have successfully created a sqlset "enrolled" as well as one called
> > "allstudents." now what i want to do is go through each studentand
> > mark ones who are in the set "enrolled." what is the best method to
> > mark the students?
>
> > initially i tried to create a dummy field in the sql and then populate
> > it in a for loop. but sqlsets appear to be immutable. how can i
> > accomplish this?
>
> > thanks,
>
> > matt
>
> > i have three tables -- students, sections and a many-to-many
> > studentsections.
>
> > relevant code:
> >     qenrolled= (db.students.id==db.studentsections.userid)&
> > (db.sections.id==db.studentsections.sectionid)&
> > (db.studentsections.sectionid==id)
> >     enrolled= db(qenrolled).select(db.students.fullname,
> > db.sections.name, db.students.id, db.studentsections.sectionid,
> > orderby=db.students.fullname)
>
> >     qallstudents= (db.students.id > 0)&(db.students.nowenrolled=='Y')
> >     allstudents= db(qallstudents).select(db.students.fullname,
> > db.students.id, orderby=db.students.fullname)
>
> >     for student in allstudents:
> >         if student in enrolled:
> >             #do something to the enrolled students
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to