Il 11/01/2011 10:05, dederocks ha scritto:
Manuele,

May I ask you how you did it?
First of all consider to define a function that returns a unique result starting from your fields in the uniques list. If theese fields are all integer (such as id of external references) you can simply append them in a string following always the same order or if they are string you car create a dictionary with the field names and values and transform it in a string that will be unique. Let's call it getUnique().

def getUnique(**kwargs):
    ...
    return out

now add this 'myid' field to your table as in the example below:

db.define_table('mytable',
    Field('field1', ...),
    Field('field2', ...),
    ...
    Field('myid', length=256, unique=True,
        compute=lambda r: getUnique(
            **dict([(x, r[x]) for x in (field2, field3, ..., )])
        )

I hope I've been clear

bye
    Manuele

Reply via email to