I've got the following query: 

        rows = 
db(query).select(db.ladore_order.total.sum().with_alias('Total'),
                                          
 db.ladore_order.total.count().with_alias('Transactions'),
                                          
 db.auth_user.first_name.with_alias('First_name'),
                                          
 db.auth_user.last_name.with_alias('Last_name'),
                                           groupby=groupy,
                                          
 orderby=[~db.ladore_order.total.sum()])

Need to modify the Total column before displaying rows (using SQLTABLE for 
that).

The problem is that something like rows[0].Total=123 doesn't work here, 
because the rows has the following structure: 

<Row {'Total': 123, 'Transactions': 4, 'First_name': 'Vlad', 'Last_name': 
'T', '_extra': {'SUM("ladore_order"."total") AS Total': 134878, 
'COUNT("ladore_order"."total") AS Transactions': 4, 
'"auth_user"."first_name" AS First_name': 'Vlad', '"auth_user"."last_name" 
AS Last_name': 'T'}}>

SQLTable which I use to display rows is not using row.Total , but rather 
gets info from _extra . 

How do I modify the column is rows properly, to be picked up by SQLTable? I 
don't really understand what this _extra is about and why the data in each 
rows gets duplicated like that. 

-- 
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/395090d0-eda8-494a-a7a8-ed1467336e0an%40googlegroups.com.

Reply via email to