Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

Data Model Questions /

Moderators: martimiz, Sean, Ed, biapar, Willr, Ingo, swaiba

Filtering a DataObjectSet by range query?


Go to End


2 Posts   1592 Views

Avatar
NicoHaase

Community Member, 6 Posts

24 March 2012 at 4:20am

Hi,
we are developing a website with SS 3 and selfwritten DataObjects. One of them holds two dates, marking a start date and an end date for events. Somehow, we need to filter the whole set of DataObjects to receive all currently active eventy (such that start date < current date < end date). The given filter() function can only compare using equality, but not ranges... Is the only way to solve this using completely a selfwritten query?
Sunny greetings
Nico

Avatar
Pipifix

Community Member, 56 Posts

10 April 2012 at 8:56pm

Hi Nico,

i don't know if you mean filtering on backend or frontend. For the ModelAdmin in BE this will maybe a good start to look at: http://www.leftandmain.com/silverstripe-tutorials/2011/03/15/taming-the-beast-remodeling-modeladmin-part-2/. But keep in mind this is for ModelAdmin for SS2. Good luck…

Pipifix.

PS:Grüße aus Leipzig.