[web2py] Re: Generically accessing the results of select

2010-10-24 Thread BigBaaadBob
On Oct 23, 10:52 pm, ron_m wrote: > The rows is a dict so if you apply the keys() function you get a list > of keys or values returns a list of values under the keys. > > rows = big_hairy_select_with_joins > > for row in rows: >   for table in row.values() >     for field in table.values() Yes,

[web2py] Re: Generically accessing the results of select

2010-10-23 Thread ron_m
A couple of comments that I hope might help. The rows is a dict so if you apply the keys() function you get a list of keys or values returns a list of values under the keys. rows = big_hairy_select_with_joins for row in rows: for table in row.values() for field in table.values() which is

[web2py] Re: Generically accessing the results of select

2010-10-23 Thread mdipierro
you can do this: results = list() for row in big_long_hairy_select_with_joins_and_stuff vals=list() for f in rows.colnames: vals.append(row[f.split('.')[1]) results.append(dict(id=row[rows.colnames[0].split('.') [1]],cell=vals)) On Oct 23, 11:08 pm, BigBaaadBob wrote: > I m

[web2py] Re: Generically accessing the results of select

2010-10-23 Thread BigBaaadBob
I must be expressing myself poorly. I'm saying that if the dal (and sql) Row class had a method like this: def column(self, colname): (table, field) = colname.split('.') return self[table][field] I could do this (which is what jqGrid wants): results = list() for row in big_long_hairy_se

Re: [web2py] Re: Generically accessing the results of select

2010-10-22 Thread Richard Vézina
Massimo fix a bug in crud.select today in trunk maybe it could help! crud.select(db.table) Now reponse to db.table.field.readable=False and db.table.field.represent='some thing' Richard On Fri, Oct 22, 2010 at 1:15 PM, BigBaaadBob wrote: > I'm probably dense, but I don't see how it does.

[web2py] Re: Generically accessing the results of select

2010-10-22 Thread BigBaaadBob
I'm probably dense, but I don't see how it does. rows.colnames has strings like 'foo.id' and 'a.name'. But you can't index into a row with those strings: you can't say r['foo.id'] or r['a.name']. You have to parse the column name and create code like r['foo']['id'] and the problem I have with th