It's not quite clear what you mean. Are these two functions two separate 
controller actions? If so, it's not clear how you can share that variable, 
as it is defined based on request.args(0) in the first function, but 
presumably request.args(0) has a different meaning in the context of the 
second function. What are you really trying to do?

On Wednesday, March 27, 2019 at 8:11:15 AM UTC-4, mostwanted wrote:
>
> I have 2 functions and i want to use the value of the variable returned by 
> one function in another function, how can i achieve this?
> I want to use the value of *resultsARE *in *function1 *in the same way in 
> *function2 
> *as attempted in the highlighted lines below.
>
> *FUNCTION1*
> def companies():
>     *resultsARE=db.services(request.args(0))*
>     rslts=db(db.business.services==resultsARE.id).select(db.business.ALL, 
> orderby=db.business.company_name)
>     services=len(rslts)
>     return locals()
>
> *FUNCTION2*
> def Results():
>     results=db.locations(request.args(0))
>     comps=companies()
>     for services in comps:
>         serv=services
>     rslts=db(db.business.place==results.id).select
> *(db.business.services==resultsARE.id)*
>     services=len(rslts)
>     return locals()
> Mostwanted
>
>

-- 
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