The change log for 1.98.1 includes: field.represent = lambda value,record: .... I think that might do what you want. Anthony
On Tuesday, August 2, 2011 12:21:11 PM UTC-4, Richard wrote: > Hello, > > Is it possible to do that : > > db.table.field.represent = lambda field1, field2: do something > > ??? > > If it not braking anything in the logic of web2py it could sometime be > of so much help to solve issue like this one... > > I have a 1 to many relation... So table1 contain the represent of my > records in table2... But since there is more then one record for the > same sample number from table1 I can't do something like this : > > dict1 = {} > for r in db(db[request.args(0)].id>0).select(db[request.args(0)].id, > db[request.args(0)].sample_id): > dict1[r.sample_id] = r.id > > db[request.args(0)].sample_id.represent=\ > lambda sample_id: A("%(sample)s" %db.table1[sample_id], > \ > > _href=URL(r=request,f='read',args=request.args(0)+'/'+str((dict1[sample_id]))) > > > > But if I could do : > > db[request.args(0)].sample_id.represent=\ > lambda id, sample_id: A("%(sample)s" > %db.table1[sample_id],\ > > _href=URL(r=request,f='read',args=request.args(0)+'/'+str((id))) > > I want to get rid off id field column in a grid... > > How it sounds? > > Richard