*modules function* def report_vars_10(table_name, field_group, field_calc, query): table_field_group = current.db[table_name][field_group] table_field_calc = current.db[table_name][field_calc] table_field_sum = table_field_calc.sum() rows = current.db(query).select(table_field_group, table_field_sum, groupby = table_field_group) grouping_calc = {} for row in rows: grouping_calc[row[table_name][field_group] ] = row[table_field_sum] return grouping_calc
*objective* rows is sorted by table_field_sum, already tried : *using* orderby = table_field_sum inside select() *result* no error occured but the result not expected *using* for row in rows.sort(lambda row: table_field_sum) *result* (no error occured but the result not expected) *question* how to achieve it in web2py ? thx -- 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/23ce02a4-e6b5-4a7b-863f-33434d9a89c4n%40googlegroups.com.