Annet, Take a look at Fran's suggestion on another problem -- http://groups.google.com/group/web2py/t/360c47ff872043d9?hl=en
You might be able to rework it for your solution. Use the beginning date as your first query. Then iterate looking for matches in the second query for those events in range. Fran, that was a nice solution by the way. Filed away in my bag of ideas. JohnMc On Jun 25, 10:14 am, annet <annet.verm...@gmail.com> wrote: > In a function I have: > > events=db((db.event.from_datum>=fromdate)& > (db.event.from_datum<=todate).select() > > The problem is that some events last more than one day, they have both > a from_date and to_date. In the view the user selects a date an the > number of weeks he wants to see the events for. For one day events > this works. However, when I have an event that starts on 23rd June and > ends on 30th June and the visitor selects 25th June as the date from > which he wants to see the events, this events isn't included in the > result. > > What I need is something like: > > events=db(((db.event.from_datum>=fromdate)| > (db.event.to_date>=fromdate))&(db.event.from_datum<=todate).select() > > I wonder whether this is possible. > > Kind regards, > > Annet. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py Web Framework" 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 -~----------~----~----~----~------~----~------~--~---