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.

General Questions /

General questions about getting started with SilverStripe that don't fit in any of the categories above.

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

searchfilter in silverstipe


Go to End


513 Views

Avatar
mi32dogs

Community Member, 75 Posts

22 May 2016 at 5:48pm

I have a question; I have a hard time finding out how to build a searchfilter in silverstipe.

I need to add this SQL to a searchfilter for a dataobject site search
‘HideList’ <> ‘1’ AND ‘LastDateTime’ > CURDATE() AND (‘ListDate’ IS NULL OR’ ListDate’ = '') OR ‘ListDate’ < NOW()) Sort By 'FirstDateTime'

The first 2 I get
array(
'HideList:not' => '1',
'LastDateTime:GreaterThan' => date("Y-m-d H:i:s"),

But the second part I need help, how do I create the following?
Is NULL statement (ListDate’ IS NULL)
An ‘OR’ statement (‘ListDate’ IS NULL OR’ ListDate’ = '') OR ‘ListDate’ < NOW())
Can you add a sort by in the searchfilter array?