[web2py] Re: Check to see if a field is in another table in a computed field

2016-02-12 Thread Greg White
At our facility we order a lot of unique items but also have an inventory of some items. I am trying to add some logic that when ordering an item, there is a check to see if the ordered item name is in the inventory (inventory.name). Then person ordering is made aware that a similar item is in

[web2py] Re: Check to see if a field is in another table in a computed field

2016-02-11 Thread Anthony
What are you trying to do? Do you want to store this information in the POrequest table, or do you want to prevent inserts if the item is not in the db.inventory table? If the latter, IS_IN_DB will certainly work, but note that validators only get run if you are using SQLFORM or if you call .va

[web2py] Re: Check to see if a field is in another table in a computed field

2016-02-11 Thread Greg White
I should have mentioned that I tried IS_IN_DB first off and it didn't work On Wednesday, February 10, 2016 at 4:25:48 PM UTC-7, Dave S wrote: > > > > 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 >

[web2py] Re: Check to see if a field is in another table in a computed field

2016-02-11 Thread Anthony
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('M

[web2py] Re: Check to see if a field is in another table in a computed field

2016-02-10 Thread Dave S
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. http://web2py.