You cannot tell easily from just looking at it.

On Feb 1, 2:05 pm, DenesL <denes1...@yahoo.ca> wrote:
> I have been thinking about this.
> How can one tell if the resulting records are going to have fields
> from multiple tables?.
>
> On Jan 30, 12:01 am, Massimo Di Pierro <massimo.dipie...@gmail.com>
> wrote:
>
>
>
>
>
>
>
> > Immagine you have the following (suggested by user Nik):
>
> > db.define_table('person',Field('name'),format='%(name)s')
> > db.define_table('company', Field('name'),format='%(name)s')
> > db.define_table('member',Field('person',db.Person),
> > Field('company',db.company))
>
> > and a new table
>
> > db.define_table('manager', Field('member',db.member))
>
> > Now you may want to a validator for managers with names of possible
> > people who are members of the company.
> > You can do it in this way (allowed):
>
> >    db.manager.member.requires=IS_IN_DB(db,'member.id',lambda row: '%
> > (name)s' % db.person[row.person])
>
> > It would be nice to be able to also use this alternative syntax (not
> > yet allowed):
>
> > db.manager.member.requires=IS_IN_DB(db(db.member.person==db.person.id),'mem 
> > ber.id','%
> > (person.name)s')
>
> > This is not yet possible but would be better because it would use a
> > join instead of one select per option. Want to larn web2py? Try
> > understand the IS_IN_DB validator in gluon/validators.py and implement
> > the proposed syntax above.

Reply via email to