Thanks, it will be very  helpful, but how can i solve the initial
problem?

On Oct 28, 11:21 am, mdipierro <mdipie...@cs.depaul.edu> wrote:
> Do not use exec:
>
>     exec('selected=[db.%s.fields]' % (i))  #The list of the
>
> rewrite as
>
>     selected = db[i].fields
>
> This
>
>     exec('datos=[m.id for m in db().select(db.%s.ALL)
>                     if string.lower(str(request.vars.dato))\
>                     in string.lower(str(m.%s))]' % (i, j[x])) #get the
>
> rewrite as
>
>     datos=[m.id for m in db().select(db[i].ALL)
>                     if string.lower(str(request.vars.dato))\
>                     in string.lower(str(m[x]))]
>
> And this:
>
>     exec('lista=db(db.%s.id.belongs(datos)).select()' % (i))
>
> rewrite as
>
>     lista = db(db[i].id.belongs(datos)).select()
>
> will make your code much faster.
>
> On Oct 28, 10:52 am, __Kyo__ <iacastil...@gmail.com> wrote:
>
>
>
> > Hi everyone, i have to make a searcher, i have to put in my input a
> > letter like "a" and then i want to search this letter in all the
> > tables that are in the database. i made this code, but the problem i
> > have in the moment i have to show or capture the solution. Could you
> > please help me with this?
>
> > if not session.incidente: redirect(URL
> > (r=request,c='default',f='login'))
> > import string;
> > def index():
> >     lista=[]
> >     headers=[]
> >     tabla=db.tables #The list of the name of the table
> >     resultado=[]
> >     if request.vars.boton:
> >         for i in tabla:
> >             exec('selected=[db.%s.fields]' % (i))  #The list of the
> > names of all the fields in the table
> >             for j in selected:
> >                 for x in range (len(j)):
> >                     exec('datos=[m.id for m in db().select(db.%s.ALL)
> > \
> >                     if string.lower(str(request.vars.dato))\
> >                     in string.lower(str(m.%s))]' % (i, j[x])) #get the
> > ids of the fields in the table
> >                     exec('lista=db(db.%s.id.belongs(datos)).select()' %
> > (i))
> >                     headers=dict([(c,db[c.split('.')[0]][c.split('.')
> > [1]].label) for c in lista.colnames])
> > #Here is the problem, because it dont show the result.
> >     return dict(tabla = tabla, lista=lista, headers=headers)
--~--~---------~--~----~------------~-------~--~----~
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