The problem is, you cannot compare (<,>,<=,>=) with None. so the
select should only be executed if request.vars.desde and
request.vars.hasta are not None. Please check that is the problem.
Else we can debug more.

On Jun 16, 12:18 pm, greenpoise <danel.sega...@gmail.com> wrote:
> Oops my bad. This one
>
> desde=datetime.datetime(request.now.year,request.now.month,request.now.day)
>     hasta=desde+datetime.timedelta(days=10)
>
>     form=FORM (H1(TABLE
> (TR(('From:',INPUT(_name="desde",_class='date',_value=desde,_id="desde",requires=IS_DATE())),
>
> ('To:',INPUT(_name="hasta",_class='date',_id="hasta",_value=hasta,requires=IS_DATE()))),
> INPUT(_type='submit'))))
>
>     rows = db((db.orden.fechaorden >=
> request.vars.desde)&(db.orden.fechaorden <=
> request.vars.hasta)).select(db.orden.waitertip.sum())
>     for row in rows: print
>     row[db.orden.waitertip.sum()]
>
>     return dict(form=form,rows=rows)
>
> On Jun 16, 1:09 pm, greenpoise <danel.sega...@gmail.com> wrote:
>
> > I dont know how this could be different but this one did worked:
>
> >    desde=request.now
> >     hasta=request.now
>
> > desde=datetime.datetime(request.now.year,request.now.month,request.now.day)
> >     hasta=desde+datetime.timedelta(days=10)
>
> >     form=FORM (H1(TABLE
> > (TR(('From:',INPUT(_name="desde",_class='date',_value=desde,_id="desde",requires=IS_DATE())),
>
> > ('To:',INPUT(_name="hasta",_class='date',_id="hasta",_value=hasta,requires=IS_DATE()))),
> > INPUT(_type='submit'))))
>
> >     rows = db((db.orden.fechaorden >=
> > request.vars.desde)&(db.orden.fechaorden <=
> > request.vars.hasta)).select(db.orden.waitertip.sum())
> >     for row in rows: print
> >     row[db.orden.waitertip.sum()]
>
> >     return dict(form=form,rows=rows)
>
> > I do however get some receding zeros after the date in my date field
> > of the form.
>
> > On Jun 15, 11:51 pm, mdipierro <mdipie...@cs.depaul.edu> wrote:
>
> > > This should never have worked.
>
> > > On Jun 15, 8:57 pm, "mr.freeze" <nat...@freezable.com> wrote:
>
> > > > I would just check that fromvar and tovar are not None before getting
> > > > the rows.
>
> > > > On Jun 15, 8:40 pm, greenpoise <danel.sega...@gmail.com> wrote:
>
> > > > > here it is:
>
> > > > > Error traceback
>
> > > > > 1.
> > > > > 2.
> > > > > 3.
> > > > > 4.
> > > > > 5.
> > > > > 6.
> > > > > 7.
> > > > > 8.
> > > > > 9.
> > > > > 10.
> > > > > 11.
> > > > > 12.
> > > > > 13.
> > > > > 14.
> > > > > 15.
> > > > > 16.
>
> > > > > Traceback (most recent call last):
> > > > >   File "/home/danel/Applications/web2py/gluon/restricted.py", line
> > > > > 178, in restricted
> > > > >     exec ccode in environment
> > > > >   File "/home/danel/Applications/web2py/applications/shroomV2/
> > > > > controllers/default.py", line 314, in <module>
> > > > >   File "/home/danel/Applications/web2py/gluon/globals.py", line 96, in
> > > > > <lambda>
> > > > >     self._caller = lambda f: f()
> > > > >   File "/home/danel/Applications/web2py/gluon/tools.py", line 2036, in
> > > > > f
> > > > >     return action(*a, **b)
> > > > >   File "/home/danel/Applications/web2py/applications/shroomV2/
> > > > > controllers/default.py", line 245, in qryfecha
> > > > >     rows = db((db.orden.fechaorden >= fromvar)&(db.orden.fechaorden <=
> > > > > tovar)).select(db.orden.waitertip.sum())
> > > > >   File "/home/danel/Applications/web2py/gluon/sql.py", line 2483, in
> > > > > __ge__
> > > > >     return Query(self, '>=', value)
> > > > >   File "/home/danel/Applications/web2py/gluon/sql.py", line 2866, in
> > > > > __init__
> > > > >     raise SyntaxError, 'Operation %s can\'t be used with None' % op
> > > > > SyntaxError: Operation >= can't be used with None
>
> > > > > On Jun 15, 9:37 pm, "mr.freeze" <nat...@freezable.com> wrote:
>
> > > > > > Do you get an error? If so, can you show the traceback?
>
> > > > > > On Jun 15, 8:01 pm, greenpoise <danel.sega...@gmail.com> wrote:
>
> > > > > > > Ok this used to work:
>
> > > > > > > def qryfecha():
>
> > > > > > >     form=FORM (H1(TABLE
> > > > > > > (TR(('From:',INPUT(_name="desde",_class='date',_id="desde",requires=IS_DATE
> > > > > > >  ())),
>
> > > > > > > ('To:',INPUT(_name="to",_class='date',_id="to",default=request.now,requires
> > > > > > >  =IS_DATE())))),
> > > > > > > INPUT(_type='submit')))
>
> > > > > > >     fromvar=request.vars.desde
> > > > > > >     tovar=request.vars.to
>
> > > > > > >     rows = db((db.orden.fechaorden >= 
> > > > > > > fromvar)&(db.orden.fechaorden <=
> > > > > > > tovar)).select(db.orden.waitertip.sum())
> > > > > > >     for row in rows: print
> > > > > > >     row[db.orden.waitertip.sum()]
>
> > > > > > >     return dict(form=form,rows=rows)
>
> > > > > > > not anymore. Leads?

Reply via email to