Try our conversational search powered by Generative AI!

EPiServer.Filters.CompareCondition

Vote:
 

Hi,

I'm trying to add a compare condition for the case where a date is GreaterThanOrEqualTo a certain value. I need to define criteria to return objects with a date type inclusive to the cut-off date.

For example:

PropertyCriteria dateCriteriaMin = new PropertyCriteria();
dateCriteriaMin.Condition = EPiServer.Filters.CompareCondition.GreaterThanOrEqualTo;
dateCriteriaMin.Name = "StartDate";
dateCriteriaMin.Type = PropertyDataType.Date;
dateCriteriaMin.Value = model.StartDate.ToString();
dateCriteriaMin.Required = true;
collection.Add(dateCriteriaMin);

Obviously there is no CompareCondition defined for >=, so I was also looking for a "not less than" operator as a substitute.

Can someone tell me how this is done in EPi? 

Thanks!

#113994
Dec 02, 2014 16:33
Vote:
 

Hey, someone else with the exact same problem:

http://world.episerver.com/forum/developer-forum/Feature-requests/Thread-Container/2007/11/Extend-CompareCondition/

Uh oh, no responses since 2007. That never bodes well...

Any other fans of LTE/GTE out there? How about NOT? Anyone?

:)

#114008
Dec 02, 2014 17:50
Vote:
 

Hi Ian,
As you say there is no CompareCondition for the 'GreaterThanOrEqual' case, but would it not be possible in your case to work around the problem by subtracting one unit (day/second/whatever) and use GreaterThan instead? I know it's not 100%, but perhaps it's good enough in your case?

#114021
Dec 03, 2014 0:28
This topic was created over six months ago and has been resolved. If you have a similar question, please create a new topic and refer to this one.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.