Thanks Massimo, I realized the need to use the tablename but as I am writing a helper class for reporting this was harder. The code has to figure out when this is needed.
I borrowed two lines of code from webgrid.py and id solved to me: self.tablenames = list(set(map(lambda c: c.split('.')[0], rows.colnames))) self.joined = len(self.tablenames) > 1 Although I have not understand it completely, it worked. On Nov 5, 4:30 pm, mdipierro <mdipie...@cs.depaul.edu> wrote: > You always have to options: > > sort at the db level (1) or sort ate the web2py level (2) > > 1) > > rows = db(query).select(orderby=db.table1.field1) > > 2) > > rows=rows.sort(lambda row: row.table1.field1) > > On Nov 5, 12:31 pm, yamandu <yamandu.co...@gmail.com> wrote: > > > I need to do .sort() in a Rows object gerenarate by select join. > > I get key error if I use onlye the field name. > > > Looks like the structure is different when it comes from a join. > > > So it sort must be different. This is bad. > > How to do it? > >