On Thursday, March 9, 2017 at 4:09:46 PM UTC-8, Alex Glaros wrote: > > I'd like to display column names and values vertically > > is there any way to write as expressed in this psudo code? > > {{for f in db.someTableRecord:}} > {{=f}} {{=value_of_the_field}}<br> > {{pass}} > > (To save programming time, I don't want to specify the field name; just > use "f") > > You should do the database access in a controller, and return the results as an array or dict. Then it's pretty straightforward Python.
in controller, for dict: def getrecords(): results = db().select( ....) return dict(records=results) in view, for dict: {{for record in records:}} {{ =record.field}}<br> {{ # or =record["field"] }} {{ pass}} Also easy to make your own table in the loop, with <tr><td>{{ =record.field}}</td></tr> thanks > > Alex Glaros > HTH /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 web2py+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.