DAL reference fields store the record ID of the linked record, not the 
value of one of its other fields. So, you comparison must be to the record 
ID of the company, not the company name.

Anthony

On Tuesday, January 16, 2018 at 4:55:13 AM UTC-5, yogeshwar khalkar wrote:
>
> Hi,
> Please help me with following.
>
> I have created the api  I am passing company_name(string) to it, for 
> select I am comparing reference Id to name.
> I get the error 
> <type 'exceptions.ValueError'> invalid literal for long() with base 10: 
> 'cadence'
> at db.company_user.company == company_name
> I actually don't know how to compare reference id to name.
>  
>
> @request.restful()
> def company_user():
>     def GET(company_name, role=None):
>         company_user_ids = [u['auth_user'] for u in 
> db(db.company_user.company == company_name
>                                                       ).select()]
>         query = db.auth_user.id.belongs(company_user_ids)
>         auth_users = db(query).select(db.auth_user.ALL)
>         return json(auth_users)
>     return locals()
>
>
> Thanks.
>
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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/d/optout.

Reply via email to