I think you want:

db.define_table('notebook',
                 SQLField('name'),SQLField
('archived','boolean',default=False))

db.define_table('entry',
                 SQLField('title'),
                 SQLField('notebook',db.notebook))

and then you need as JOIN as you say

     records=db(db.entry.notebook==request.vars.notebook)\
                       (db.entry.notebook==db.notebook.id)\
                       (db.notebook.archived==False)\
             .select(db.entry.ALL,orderby=~cdb.entry.id)

Massimo


On Jan 28, 9:47 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
> I do not understand. Can you do an example of what you want?
>
> Without understanding I can see something is missing:
>
> > db.define_table('notebook',
> >                 SQLField('name'))
>
> > db.define_table('entry',
> >                 SQLField('title'),
> >                 SQLField('notebook',db.notebook))
>
> db.entry.notebook.requires=IS_IN_DB(db,'notebook.id','%(name)s')
>
> > def entries():
> > #return the notebook itself
> >     records=db(db.entry.notebook==request.vars.notebook)\
> >              .select(orderby=~cdb.entry.id)
>
> # you do not need the select for the rest to work
>
> >     form=SQLFORM(cynotedb.entry,fields=['notebook'])
>
> if form.accepts(request.vars,session):
>     session.flash='record inserted'
>     redirect(URL(r=request)) # or somewhere else
>
> >     return dict(form=form, records=records)
>
> On Jan 28, 9:34 pm, MadWalker <maddalwal...@gmail.com> wrote:
>
> > is it able to do a joint table entries selection?
> > by only selecting only those that i need but still having those
> > database stored
> > and not delete it away?
>
> > the table database and code are listed as
>
> > db.define_table('notebook',
> >                 SQLField('name'))
>
> > db.define_table('entry',
> >                 SQLField('title'),
> >                 SQLField('notebook',db.notebook))
>
> > def entries():
> > #return the notebook itself
> >     records=db(db.entry.notebook==request.vars.notebook)\
> >              .select(orderby=~cdb.entry.id)
> >     form=SQLFORM(cynotedb.entry,fields=['notebook'])
> >     return dict(form=form, records=records)
>
> > if there are 3 notebook, instead of letting it list out the one that i
> > dun want in the notebook itself,
> > is it able to do a selection?
> > but still letting the database itself be delete?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py Web Framework" group.
To post to this group, send email to web2py@googlegroups.com
To unsubscribe from this group, send email to 
web2py+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to