Thanks!
I was actualy missing the 'unique=True' (IS_NOT_IN_DB(...) doesn't
work), and then I'll need to add a 'try.. except' sequence to trap an
attempt to insert a duplicate.

On 11 jan, 10:32, Manuele Pesenti <manuele.pese...@gmail.com> wrote:
> 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 auniqueresult
> 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 beunique. 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