I can't replicate the issue you're having. That syntax works. Check again your code ....
BTW: it's quite a strange model. you want the language to be unique in the first table. In the second one you reference the first table (that is unique by definition) with a non unique reference, but then you compute a field to be unique.......if this is not a cut/paste just to show us a possible problem and is in fact your underlying model, I'd advise to rethink to it :P On Monday, May 27, 2013 3:53:03 PM UTC+2, Matteo Luperto wrote: > > Hi, I want to compute a field based on the value of another field, which > is a foreign key, in a way similar to: > > db.define_table('language', > Field('language', 'string', required = True, unique = True, length = > 64), > format='%(language)s' > ) > > db.define_table('problemsHere', > Field('language', 'reference language', required = True, unique = > False), > Field('otherField', 'integer'), > Field('computedField', > length=32, > unique=True, > writable=False, > readable=False, > compute=lambda row: db.language(row['language']). > language) > ) > I've tried both syntaxes from this similar > question<https://groups.google.com/forum/?fromgroups#!topic/web2py/x53LPKqRpgI>but > none of them seems to work for me. The computedField is always set to > "None". > Does anybody knows a way to access a foreign key in a computed field, > solving my problem? > > Thank you in advance, > ~Matteo > -- --- You received this message because you are subscribed to the Google Groups "web2py-users" group. To unsubscribe from this group and stop receiving emails from it, send an email to web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.