can you show us your controller? and db model? On Sunday, August 2, 2015 at 11:18:11 AM UTC-5, P Page-McCaw wrote: > > I am having a hard time understanding how to get values from a row in a > view. I think I am being really dim. (It would really help us amateurs to > have a more full description of how to do database queries. Really I need > "The Very Stupid Person's Guide to..." because I read the guide and then do > what it says (or so I think) and can't get it to work. > > The generic problem is how to retrieve data from a linked table in a view. > I have problems (this tells you how pathetic I am [really though I'm a good > biologist]) both where I want to traverse from the table that carries the > 'reference other_table' field and from the target table. I keep thinking I > get the syntax, but the next time I try, fail. > > I have tried many things and though I can get the entire row to show up on > the web page with many variants of: > {{ =db.table_1_name(m.field_name) }} > > This shows in the page as <Row {'other_table_field_name', 'value'}> with > the whole row rendered as text. So clearly the row is accessed in the view. > > But what I want is table_1_name.'other_table_field_name' and > {{ =db.table_1_name(m.field_name).field_name }} > returns an error: can't get field_name from None Type and m.field_name > yields the id for the correct reference to the table_1_name. m is the row > of the set being iterated through. > > Somewhere, something is being gently and kindly coerced. But I am not > smart enough to figure out what is happening. > > Thanks >
-- 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.