I figured it out, initially I was getting an error, it told me that I can
not split the date, then i did this:
def search():
form = SQLFORM.factory(
Field("start_date", type="date"),
Field("end_date", type="date"))
if form.process().accepted:
q = ((db.birthdays.bornday >= form.vars.start_date)
&(db.birthdays.birthday
<= form.vars.end_date))
rows = db(q).select()
return locals()
& it worked, but now I am facing a-little challenge, I want to use he
results of rows in another function called clients, how can i do that?
Regards;
Mostwanted
On Thursday, February 20, 2020 at 12:05:15 AM UTC+2, Clemens wrote:
>
> Hi,
>
> is your problem receiving no result or the wrong result? How is the table
> definition of your birthday table and why is the birthday not just a field
> a corresponding person table?
>
> Best regards
> Clemens
>
>
> On Wednesday, February 19, 2020 at 10:49:11 PM UTC+1, mostwanted wrote:
>>
>> I'm trying to use SQLFORM.factory to search by date but its failing, it
>> is somehow possible to that & i'm missing something?? If so where can i
>> rectify my code to give me results?
>>
>> *MY FUNCTION*
>> def search():
>> form=SQLFORM.factory(Field('SEARCH', 'date')
>> if form.accepts(request):
>> tokens=form.vars.SEARCH.split()
>> query=reduce(lambda a,b:a&b, [db.birthdays.contains(k) for k in
>> tokens])
>> people=db(query).select(orderby=db.birthdays.Person)
>> else:
>> people=[]
>> return locals()
>>
>> Regards;
>>
>> 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 [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/web2py/afbfabac-fbd2-415b-abb8-b1eca33cbcc7%40googlegroups.com.