I think I was miss leading by your example where
orderby=db.table.reference.Field

To me it should not read like that it should read : orderby=db.table.Field

And Niphold is right you were missing a join, but it should had works if
you only want to order base on the id of the referenced field if you where
using the FK field of your db.table.

Hope I am clearer.

Richard


On Fri, Mar 1, 2013 at 10:58 AM, BlueShadow <kevin.bet...@gmail.com> wrote:

> when I change the line in default.py(example from my first post) to: row =
> db(db.table.refrence == db.refrencedtable.Field).
> **select(db.table.ALL, orderby=db.refrencedtable.**Field)
> if I do a print row or use row in the view somehow it is blank/empty
>
>
> On Friday, March 1, 2013 4:32:31 PM UTC+1, Niphlod wrote:
>>
>> what does it mean "an empty variable" ?
>>
>> On Friday, March 1, 2013 4:04:47 PM UTC+1, BlueShadow wrote:
>>>
>>> thanks Niphlod for this it sounds really good but unfortunatly I get an
>>> empty variable when I do this.
>>> Richard i don't really understand what you like to say.
>>>
>>>
>>> On Wednesday, February 27, 2013 10:28:12 PM UTC+1, Niphlod wrote:
>>>>
>>>> you should join them and then do the ordering. auto-references are a
>>>> nice facility but comes with a price: you can't use them just like if your
>>>> records were in a single table to do a select or an update....
>>>>
>>>> db(db.table.refrence == db.refrencedtable.Field).**select(db.table.ALL,
>>>> orderby=db.refrencedtable.**Field)
>>>>
>>>> On Wednesday, February 27, 2013 10:17:28 PM UTC+1, BlueShadow wrote:
>>>>>
>>>>> Hi,
>>>>> I got two Tables lets call them table and referencedtable. table has a
>>>>> field which is a reference to referenced table. Now I like to select all
>>>>> entries from table and order them by a field in the referenced table. In 
>>>>> my
>>>>> opinion it should work like this:
>>>>> #defauft.py
>>>>>  rows=db().select(db.table.ALL**, orderby=db.table.reference.Fie**ld)
>>>>>
>>>>> #db.py
>>>>>
>>>>> db.define_table('**refrencedtable',
>>>>>     Field('Field',length=512)
>>>>>     )
>>>>>
>>>>> db.define_table('table',
>>>>>     Field('Title',length=1024),
>>>>>     Field('refrence',db.refrencedt**able),
>>>>>     Field('Test','upload')
>>>>>     )
>>>>> but when I do this I get an error that referncedtable has no Field
>>>>> called Field.
>>>>>
>>>>>  --
>
> ---
> 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/groups/opt_out.
>
>
>

-- 

--- 
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/groups/opt_out.


Reply via email to