> > tb_categorias.format = '%(nombre)s' #This does not work > > tb_obras.categoria.requires = IS_IN_DB(db, tb_categorias.id, '%(nombre)s') >
Both the "format" argument to define_table() and the "label" argument to IS_IN_DB() can be a function that takes a row, so you can just define a function that takes a record from categorias and returns the label. If that's all you need nombre() for, then you don't even have to bother making it a virtual field. If you need a virtual field for other purposes and don't want to have to write the function twice, I'm not sure if it would work, but you might even be able to do lambda r: r.nombre. Note, you might consider using a new style virtual field<http://web2py.com/books/default/chapter/29/6#New-style-virtual-fields-(experimental)> . Anthony

