Re: [web2py] Virtual field in SQLFORM.grid

2016-01-20 Thread Marcello Parra
I could make it work. Changed the virtual field from: Field.Virtual('total', lambda row: row.trabalho.konsulta.count()), To: Field.Virtual('total', lambda row: db((db.konsulta.trabalho_id== row.trabalho.id)).count()) Both fields work in the shell, but just the second works in the grid... Can so

Re: [web2py] Virtual field in SQLFORM.grid

2016-01-20 Thread Marcello
In other words... Is there a way to show a total of the child table in each row of the master table (grid) ?? Thanks On Tuesday, January 19, 2016 at 5:52:51 PM UTC-2, Marcello wrote: > > Yes. I can see the tables... > And yes... I can call the function.. It's working OK... > > Thanks... > > O

Re: [web2py] Virtual field in SQLFORM.grid

2016-01-19 Thread Marcello Parra
Yes. I can see the tables... And yes... I can call the function.. It's working OK... Thanks... On Tue, Jan 19, 2016 at 4:39 PM, Fabiano Almeida wrote: > Hi Marcello, > > Can you see your tables in appadmin? > > And your lambda, you can create and call function to count in konsulta's > table and

Re: [web2py] Virtual field in SQLFORM.grid

2016-01-19 Thread Fabiano Almeida
Hi Marcello, Can you see your tables in appadmin? And your lambda, you can create and call function to count in konsulta's table and return the number. Field.Virtual('total', lambda row: kontagem(row.id)) Att., Fabiano. 2016-01-19 15:09 GMT-02:00 Marcello : > Hello, > > I have a one to many