db(db.person.name=='Bob')(db.person.position==db.position.id).select
(orderby=db.position.sort_order)

On Oct 2, 9:39 pm, BioNip <bionic.nip...@gmail.com> wrote:
> Consider this code:
>
> > db.define_table('position',
> >     Field('name'),
> >     Field('sort_order', 'integer'),
> >     )
>
> > db.define_table('person',
> >     Field('name'),
> >     Field('position', db.position),
> >     )
>
> > #This sorts by the position.id
> > db(db.person.name=='Bob').select(orderby=db.person.position)
>
> > #This fails.
> > db(db.person.name=='Bob').select(orderby=db.person.position.sort_order)
>
> I want a list of people, ordered by their position.sort_order, not
> position.id . Does anyone know how this can be accomplished?
>
> Thanks.
>
> -nip
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"web2py-users" 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