You can probably use the compute keyword to the particular field. http://www.web2py.com/books/default/chapter/29/06/the-database-abstraction-layer#Computed-fields
On Tuesday, March 10, 2015 at 3:49:05 PM UTC-4, Alex Glaros wrote: > > I want to insert the record id into one of its fields during record > creation in form > > right now, using work-around right after the record is created. > > here is the record being created > > messageID = db.InternalMessage.insert(**db.InternalMessage._filter_fields( > form.vars)) > > right afterwards, this is executed > > db(db.InternalMessage.id == messageID.id).update(messageThreadID = > messageID.id) > > it finds the record just created and updates it. > > so I want field messageThreadID field to be populated with the record id > field. Can it be done using less resources? Is there a way to put the id > in form.vars so that the top line above is all that's needed? > > thanks > > Alex Glaros > > -- 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.

