it cannot be done because the computation is done before the insert while the id is assigned by the database after the insert.
On Aug 27, 8:32 am, dederocks <[email protected]> wrote: > Hello, > > I am trying to generate a field with a default value based on the > record id -- but it doesn't work. For example: > > db.define_table('article', > Field('designation', type='string', length=200, required=True, > requires=IS_NOT_EMPTY()), > Field('details', type='string', length=2000), > Field('intcodebarre', type='string', length=50, compute=lambda r: > "SolA%-.6d" % r['id']), > format='%(designation)s') > > Is not accepted (but works for a declared field). For a future patch > or bad design on my side? > > BR, Andre

