On Thu, Jan 14, 2010 at 3:26 PM, mdipierro <mdipie...@cs.depaul.edu> wrote:
> I think all the problems arise from the fact that you do: > > IS_IN_DB(db(db.opportunity.id==db.task.opportunity_id),...) > > this is a join and you cannot do a JOIN in a validator because you are > referencing one table, not the temp table result of a join. > > Parhaps this is what you want: > > db.task.opportunity_id.requires=IS_NULL_OR( > IS_IN_DB(db,'opportunity.id',lambda opp: > opp.oppty_main_id.name)) > > Mind that if you have any broken reference (like a NULL reference or a > reference to a record that no longer exist opp.oppty_main_id.name will > break. > > Also mind that this is very slow since it results in a select for > every record in the SELECT/OPTION. > > I would recommend caching the records and their names and use > IS_IN_SET instead of IS_IN_DB. > > Massimo > > Thank you. I'll have to take a better look into this. Miguel--
You received this message because you are subscribed to the Google Groups "web2py-users" group.
To post to this group, send email to web...@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.