Hi,
we are using the RelativeDateOperand-Condtions like "LastMonth" for some fields in our grid. Now we want to use the start and end time of these timespans for a where clause.
I was able to get the start- and end time in the RecordFilterChanged Eventhandler by using Reflection on the ComparisonCondition object with:
var fieldEndTime = condValue.GetType().GetField("cachedEnd", System.Reflection.BindingFlags.Public |
System.Reflection.BindingFlags .NonPublic | System.Reflection.BindingFlags.Instance);
It doesn't look very clean but it works. Now we need start and end time before initializing the grid. Is there a chance to get the two dates for a RelativeDate?
kind regards
Hase
Well the dates are cached when the operand is used to evaluate a match so you could get the operand you want from the static properties on the SpecialFilterOperands class and call the IsMatch method. Note the operands returned there are wrappers so you would need to get the "_cachedOperand" from it to get the relative date operand.
var operand = SpecialFilterOperands.LastMonth; // note if you're not using currentculture then you'll need a custom // derived context where the Culture of the CurrentValue has the// culture you are usingoperand.IsMatch(ComparisonOperator.Equals, DateTime.Today, null);
var operand = SpecialFilterOperands.LastMonth;
// note if you're not using currentculture then you'll need a custom // derived context where the Culture of the CurrentValue has the// culture you are usingoperand.IsMatch(ComparisonOperator.Equals, DateTime.Today, null);