Hi again, 

Sorry to keep posting here, but I really think this information must be 
useful as it is to me. 

Now, you can't just use deep references in the format attribute for a 
table, so you use a lamda. Something like:

 format=lambda r: r.schedule.company.name + ': ' + r.schedule.name + ': ' +r
.descrip + ' - ' + r.done_by.name

Also, when it comes to sorting, you can't just say: 

select(sortby=db.mytopic.schedule.company.name)


nor can you use:

select(sortby=db.company.name)


(It works, but you get a loose join and too many rows returned. Probably 
distinct would fix, but, meh.)

So instead you can wait until the results are returned as use:

rows.sort(lamba row: row.schedule.company.name)


and to sort multiple columns: 

rows.sort(lambda row: row.schedule.company.name + row.schedule.name)

Again, hope this helps. It is speeding up my designs very much.

Finally, don't use this pattern if you allow nulls in the table, such as 
having a topic which is not forced to be assigned to schedule/company to 
begin with, for instance. Or if you do, make sure you check for None type 
objects in these deep references.

Regs.

-- 
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 [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to