Wonderful! It works just fine.
Thanks. Richard 2010/6/3 Yarko Tymciurak <resultsinsoftw...@gmail.com> > > On Jun 3, 10:26 am, Jean Guy <jean...@gmail.com> wrote: > > Hi, > > > > I would like to know if there is a way as simple of "requires = IS_IN_DB" > to > > show a dropbox of what is already in my table, but without the need of > > requiring that field be entered in my other table. I have many fields > that > > need dropbox but they are not all used at the same time (nulls fields : > not > > normalised table)... > > > > Hope I am clear! > > > > Here an example : > > > > db.define_table('person', > > SQLField('fname'), > > SQLField('lname'),format='%(fname)s %(lname)s') > > > > db.define_table('dog', > > SQLField('name'),format='%(name)s') > > > > db.define_table('cat', > > SQLField('name'),format='%(name)s') > > > > db.define_table('ownership', > > SQLField('person', db.person), > > SQLField('dog', db.dog), > > SQLField('cat',db.cat)) > > > > db.ownership.person.requires = IS_IN_DB(db,'person.id','%(fname)s > > %(lname)s') > > db.ownership.dog.requires = IS_IN_DB(db, 'dog.id', 'dog.name') > > db.ownership.cat.requires = IS_IN_DB(db, 'cat.id', 'cat.name') > > > > I would like to be able to add the relation between person and dog > without > > have to enter a cat in the case of person that has no cat. > > "A person either has no cat, or the cat's information must exist for > them to own it": > > db.ownership.cat.requires = IS_NULL_OR( IS_IN_DB( db, 'cat.id', > 'cat.name') ) > > Does that help? > > Regards, > - Yarko > > > > > Thanks. > > > > Jonhy