How does one apply formatting to a field which is not defined in a table, 
but rather the result of a sum() operation?  

Below, the field 'price' is formatted in the table definition as currency, 
and displays in forms with appropriate currency symbol and thousands 
separators.  However, after the sum() operation is applied, the resulting 
computed field no longer has access to that formatting function.

---------------
simple example -  in controller...

def func()
  type = db.table1.type
  price = db.table1.price

  rows = db().select(type, price.sum(), groupby=type)

  tbl = SQLTABLE(rows)

return dict(tbl=tbl)
---------------

I'm currently using an SQLTABLE but could alternatively use an SQLFORM.grid 
instead if that provides a better solution.  I can't seem to find a way to 
attach a lamda function to the computed field in order to provide 
formatting for that specific field in the form/grid.

Thanks.





-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to