something like this def _compute(): return request.vars.in_time + request.vars.duration##
db.define_table('mytable', Field('in_time','datetime'), Field('duration', 'integer'), Field('end_time','datetime', compute = _compute)) On Feb 5, 6:51 pm, Adi <aditya.sa...@gmail.com> wrote: > Hi, > > I have a table with 3 fields: > > db.define_table('mytable', Field('in_time','datetime'), > Field('duration', 'integer'), Field('end_time','datetime')) > > The user enters in_time and duration (in hours) in SQLFORM, but now I > want to calculate and store end_time using > end_time = in_time + timeinterval(hours = duration). > > I'm not able to achieve this. How do I refer to a record's other > fields to specify default value of a field? > > Thanks. -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web...@googlegroups.com. To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.