I assume you've got something like:

db.define_table('story',Field('text'), ...)
db.define_table('storyline',Field('story_id',db.story,requires=IS_IN_DB(db,'story.id','%
(text)s'), ...)


Then you can query the db:

rows=db(db.storyline.story_id==session.story_id).select(db.story.ALL,left=db.story.on(db.story.id==db.storyline.story_id))

You can return dict(rows=rows) or return dict(rows=SQLTABLE(rows)),
the latter providing more formatting and functionality.





On Dec 12, 8:49 pm, Shel <joralemonshe...@gmail.com> wrote:
> Hello,
>
> I am trying to create a form that displays all the rows in a table
> where, for example, db.storyline.story_id = session.story_id, and I
> cannot for the life of me figure out how to do this.  It seems like
> this should be very simple, but nothing I have tried works.  I am not
> sure how to use a query as the data source for a form, or how to
> create a form that shows all the rows returned by the query.  Any help
> would be appreciated.    Especially if anyone could point me to some
> sample code that does something similar, that would be great.
>
> Thank you,
> Shel

Reply via email to