I searched for "compute" in the scribd document on the website and didn't find this. It should be included as it is quite helpful.
On Feb 5, 11:42 pm, Thadeus Burgess <[email protected]> wrote: > Is this not in the book or did I miss it? > > -Thadeus > > > > On Fri, Feb 5, 2010 at 5:34 AM, Adi <[email protected]> wrote: > > Awesome, works as expected. > > > Only change is that the request variables were strings and had to be > > converted into respective data types. Thanks a lot. > > > On Feb 5, 4:19 pm, hywang <[email protected]> wrote: > >> 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 <[email protected]> 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 [email protected]. > > To unsubscribe from this group, send email to > > [email protected]. > > For more options, visit this group > > athttp://groups.google.com/group/web2py?hl=en. -- You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/web2py?hl=en.

