Virtual Fields do not help you here because they are computed when
records are extracted not when stored. virtual fields are not stored
at all.

The 'input' table already has an auto-increment id field. You cannot
gave two autoincrement ids. It is bad design and would slow the
database a lot.

You can do something like this:

import uuid
db.define_table('input',
         Field('number', 'string',
str(default=uuid.uuid4()),readable=False,writable=False),
         Field('value', 'integer'))

On Jan 2, 2:39 pm, Rick <sababa.sab...@gmail.com> wrote:
> Hi,
> In addition to the records that are submitted with a SQLFORM, I want
> to give each record a specific "identification" number, so that the
> first record has number=1 and so on:
>
> ==from model/db.py==
> db.define_table('input',
>         Field('number', 'integer'),
>         Field('value', 'integer'))
>
> ...My problem is that I don't know how to automatically add the number
> to this form:
> form = SQLFORM(db.input, fields=['value'])
>
> Thanks in advance for help.

Reply via email to