I could be wrong and am still new here but maybe SQLFORM.Factory? Thats
what I use on a form that has 2 tables.


On Fri, Jun 28, 2013 at 1:41 PM, Cliff Kachinske <cjk...@gmail.com> wrote:

> I have two tables something like this:
>
> db.define_table('item',
>   Field('name'),
>   Field('on_hand', integer),
> )
>
> db.define_table('item_batch',
>   Field('item', 'reference db.item' ...),
>   Field('batch_yield', integer),
> )
>
> Every time I insert a item_batch record, I increment the on_hand field of
> the item table by the quantity in tatch_yield.  Easy to do using SQLFORM.
>
> But if I have to update the batch_yield I want to update the item.on_hand
> field as well.  I also use an onvalidation function to make sanity checks
> on the updated batch_yield entry, such as verifying that the new value does
> not make item.on_hand a negative number.
>
> Using SQLFORM, when is the best time to update the item.on_hand field?
>
> I want to make sure all of the updates are in the same transaction, so
> that if one fails, they all get rolled back.  How can I do this?
>
> Thanks,
> Cliff Kachinske
>
> --
>
> ---
> 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/groups/opt_out.
>
>
>

-- 

--- 
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/groups/opt_out.


Reply via email to