SQLFORM.grid does not take rows. It take the query itself. It needs
the query to optimize the select for orderby and pagination. You can
in fact do:

query =(a.dialstatus=='ANSWER')& (a.inicio>=dt1)&(a.inicio<=dt2)
left =
(b.on(a.id_accountcode==b.id),rp.on(a.id_rutaproveedor==rp.id),r.on(rp.id_r
utas==r.id))
SQLFORM.grid(query,left=left)

No need for your own select.

On Oct 12, 1:12 pm, mmartinez <alexra...@gmail.com> wrote:
> Hello list my doubt is how I can create a list SQLForm.grid from this
> consultation that I make to the database
>
> dt1=datetime.datetime(*time.strptime(request.vars.desde,'%Y-%m-%d %H:
> %M:%S')[0:6])
> dt2=datetime.datetime(*time.strptime(request.vars.hasta, '%Y-%m-%d %H:
> %M:%S')[0:6])
>
> query =(a.dialstatus=='ANSWER')& (a.inicio>=dt1)&(a.inicio<=dt2)
> left =
> (b.on(a.id_accountcode==b.id),rp.on(a.id_rutaproveedor==rp.id),r.on(rp.id_r 
> utas==r.id))
> rows=db(query).select(b.ani,a.destino,a.answeredtime,a.inicio,a.valor,
> left=left)
>
> SQLFORM.grid(rows)

Reply via email to