Dave S - indeed, the only field that will be present in the grid is the id field. I've omitted the code that, within that function, changes the representation of the id field to something more interesting than just ids. This detail probably shouldn't matter for the sake of this question, however. Still, I've added an ellipsis to the code in the question to reflect that other fields may be present as well.
On Tuesday, March 17, 2015 at 3:25:59 PM UTC-5, Dave S wrote: > > > > On Tuesday, March 17, 2015 at 12:38:18 PM UTC-7, Spokes wrote: >> >> I'd like to get the id associated with each row of a grid. The grid is >> created like this: >> >> field_names = ['id'] >> field_list = [f for f in db.t_table1 if f.name in field_names] >> >> query = (db.t_table1.id > 0) >> >> grid = SQLFORM.grid(query, fields = field_list, orderby = '<random>', >> ... ) >> >> What's the best way to obtain a list of the ids? >> > > I must be missing something, because it looks to me like the code above > only gets a list of ids. The conditional in the list comprehension will > only match for one field. > > /dps > > -- 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/d/optout.

