Maybe use the represent attribute in the field constructor db.table.field.represent = lambda val, row: function())
and use: locale.format('%10.2f', val, grouping=True) Best, Annet Op maandag 24 augustus 2020 om 07:43:15 UTC+2 schreef Vlad: > I've got the rows to be displayed in a table: > > rows = db(query).select(db.orders.total.sum().with_alias('Total'), > ...............) > > and using > > SQLTABLE(rows) > > to show the data. > > How can I format this total.sum() in the SQLTABLE? More specifically, this > total is the total amount in cents, and I need to display it in dollars, > i.e. divide by 100 and append with '$'. > > It's easy to do it if using TABLE and iterating over rows, but SQLTABLE is > pretty convenient to use, so I'd like to stick with it. > > Is there a way to customize the fields like this in SQLTABLE ? > > > > > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/web2py/73a81e2c-4392-4cbd-880b-85d334bee95bn%40googlegroups.com.