there's something wrong with the code something = db.table.insert(**mapping)
returns the db.table.id that has been inserted. in this piece of code, using messageID.id doesn't really make much sense... On Tuesday, March 10, 2015 at 8:49:05 PM UTC+1, 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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.