SQLTABLE, columns, and joins

26 views
Skip to first unread message

Dave S

unread,
Jul 25, 2017, 4:13:34 PM7/25/17
to web2py-users
Last night I couldn't figure out to use SQLTABLE's columns param when ROWS I'm trying to display are from an inner join.  The ROW objects are composed of dict-like objects for both [or more] tables, i.e.,
{{segment={id=1234567890, waypoint="Thishereplace",route="thataway", partof=666}},
 
{run={id=666,description="InAHandbasket"}}

(my apologies if some of those brackets should be square instead of curly; I forgot to cuttenpaiste last night when the examples were dancing before my eyes)

In the columns param, [db.run.id, ...] didn't work, and [run[].id, ...] didn't work, and I don't think [myrows.run.id, ...] worked (where myrows is the query result).  And query results don't name the ROW structure inside the ROWS.  So what would work?

BTW, I did find a way around this problem ... make the select() do just the fields needed for the display, which I understand to be the way SQLFORM.grid works.  Oh, and I probably could use this project as a way to learn to use datatables or a similar js library.  But is there an answer to my original approach?

T'anks
/dps

Reply all
Reply to author
Forward
0 new messages