Below logic can be used for filtering using from date and to date.
dateRange.value(SysQuery::range(FromDate.dateValue(), ToDate.dateValue()));
Form level in the execute query can write the below logic.
QueryBuildRange dateRange = SysQuery::findOrCreateRange(this.queryBuildDataSource(), fieldNum(MyTable, MyDateField));
dateRange.value(SysQuery::range(FromDate.dateValue(), ToDate.dateValue()));
Form level in the execute query can write the below logic.
QueryBuildRange dateRange = SysQuery::findOrCreateRange(this.queryBuildDataSource(), fieldNum(MyTable, MyDateField));