Trying to filter a specific data range in AX and having trouble.
This is what I am trying to do, in pseudo code..
(start >= now-30 && (end == null || end >= now-30))
||
(end >= now-30 && (start == null || start >= now-30))
||
(start >= now-30 && end >= now-30)
Here is how I tried to do it
CLASS DECLARATION
QueryBuildRange filterDates;
DS INIT METHOD
filterDates=this.query().dataSourceName('LogTable').addRange(fieldNum(LogTable,startDateTime));
filterDates=this.query().dataSourceName('LogTable').addRange(fieldNum(LogTable,endDateTime));
DS EXECUTEQUERY METHOD
filterDates.value(strFmt("(%1 >= %3 && (%2 == %4 || %2 >= %3)) || (%2 >= %3 && (%1 == %4 || %1 >= %3)) || (%1 >= %3 && %2 >= %3)", fieldStr(LogTable, startDateTime), fieldStr(LogTable, endDateTime), currentTimeMinus30Mins, DateTimeUtil::minValue()));
AX seems to ignore pretty much any completex query I enter.
Thanks