This is currently not possible unless you denormalize and store the count
in a column of A.
On Saturday, 29 September 2012 23:01:22 UTC-5, alex wrote:
>
>
> I have a relation [1:n] from table A to table B.
>
> define_table('A',
> Field('name', type='string'))
>
> define_table('B',
> Field('ref_a', type='reference A'))
>
>
>
> Then I have this grid
>
> qry = db.A.id>0
> grid = SQLFORM.grid(qry,links=links)
>
> How do I write links (and the lambda function in it) in order to have in
> the grid an additional column with the count of references to A
> (db.B.ref_a.count()) ?
>
--