On Wednesday, February 10, 2016 at 2:01:52 PM UTC-8, Greg White wrote: > > Want a computed field to show whether or not a field value exists in > another table >
I'm not sure that is the right approach. I think that the standard validator IS_IN_DB() is what you want, instead. <URL:http://web2py.com/books/default/chapter/29/07/forms-and-validators#Database-validators> (IS_IN_DB is the second validator in that section) The example shown appears to be similar to what I think you're trying to do. /dps > started with this... > > db.define_table( > 'inventory', > Field('name'), > Field('qty', label='Quantity'), > Field('MatSize',label='Material Size'), > format = '%(name)s') > > db.define_table( > 'POrequest', > Field('name', 'reference requestor', label='Requestor'), > Field('JobNum', 'reference jobs', label='Job #'), > Field('description', 'text', notnull=True), > Field('InInventory', compute=lambda r: r['description'] IN r[ > db.inventory.name]), <<< this row right here is what I need help with > format = '%(name)s') > > trying to verify row by row in a computed field if > db.POrequest.description is in any row of db.inventory.name > > help please. > -- Resources: - http://web2py.com - http://web2py.com/book (Documentation) - http://github.com/web2py/web2py (Source code) - https://code.google.com/p/web2py/issues/list (Report Issues) --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.