On Wednesday, February 10, 2016 at 5:01:52 PM UTC-5, Greg White wrote:
>
> Want a computed field to show whether or not a field value exists in
> another table
>
> 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')
>
compute=lambda r: not db(db.inventory.name == r.description).isempty()
Anthony
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.