I cannot reproduce this error with your code. Something else is interfering 
with it. 

On Wednesday, 18 July 2012 05:33:53 UTC-5, Ashraf Mansour wrote:
>
> *Hi, All:*
> *
> *
> *Having these two tables*
>
> *db.define_table(*
> *    'salescompany',*
> *    Field('name') )*
> *
> *
> *db.define_table(*
> *    'salescompany_user',*
> *    Field('user_id', db.auth_user , unique = True ),*
> *    Field('salescompany_id', db.salescompany    ) )*
>
> *in these three lines*
>
>    * current_user_id = auth.user.id*
> *    *
> *    xsalescompany_id=db(db.salescompany_user.user_id == 
> current_user_id).select(db.salescompany_user.salescompany_id).first()*
> *      *
> *    salescompany_name=db(db.salescompany.id == int(xsalescompany_id) 
> ).select(db.salescompany.name).first()*
>
> I am trying to get the name of the salescompany for the current user.
>
> unfortunately, I get this error
>
> <type 'exceptions.KeyError'> 'id'
>
> pointing to the third line.
>
> Pls, enlighten me.
>
> Thanks,
>
> Ashraf
>

-- 



Reply via email to