I did a bunch of work in py4web yesterday getting this to work. I was
getting a similar error - I updated the py4web 'grid' code to fix it. I've
never used an Expression like this in web2py before so I can't say for sure
that it is supported.
A couple other things I noticed.
1. You don't
I'm trying this code below & i'm getting * 'Expression' object has no attribute
'tablename' * ERROR*, *whats wrong with my code? or What am i missing??
*def payments():payments_sum_field =
db.payments.amount.sum().with_alias('total')
grid_table=SQLFORM.grid(db.payments,
It looks like there is support for groupby in SQLFORM.grid which is what
you'd need to build the proper SQL statement.
I haven't tried this with web2py. If I were, I'd try adding a groupby
clause and a list of fields that include your sum field. Something like
this (not tested)
3 matches
Mail list logo