Not quite. It's more like this: db.define_table('person',SQLField('name')) db.define_table('method',SQLField('name')) db.define_table('contact', SQLField('person',db.person), SQLField('method',db.method), SQLField('info'))
work = db.method.insert(name='Work') home = db.method.insert(name='Home') cell = db.method.insert(name='Cell') email = db.method.insert(name='Email') sam = db.person.insert(name='Sam') db.contact.insert(person=sam, method=email, info='s...@example.com') db.contact.insert(person=sam, method=work, info='555-1234') max = db.person.insert(name='Max') db.contact.insert(person=max, method=home, info='555-2121') db.contact.insert(person=max, method=cell, info='555-4017') I'd tell you exactly how I did it in Perl, but I don't want to influence anyone who might have a better idea. :-) I will say that in my situation, there can potentially be many more methods (Fax, Twitter, AIM ID, ICQ UIN, Yahoo! ID, Jabber, Homepage, Public Calendar, and maybe even World of Warcraft), but the user generating the table will be able to indicate a subset in which they are interested when the cross-tab table is generated. On Jun 15, 8:57 am, mdipierro <mdipie...@cs.depaul.edu> wrote: > I assume you have > > db.define_table('person',SQLField('name'),SQLField('email') > db.define_table('contact_method',SQLField > ('person_id',db.person),SQLField('work_phone')) > > you can do: > > rows=db(db.person.id==db.contact_method.person_id).select() > for row in rows: > print row.person.name > print row.person.email > print row.contact_method.work_phone > > Hope this answer your question. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---