Axapta - Don't Miss One Second When filtering Between Two DateTime Fields
Views (1329)
If we take time 00:00 of day after last day and use < instead of <= we don't miss even one second:
fromDate = DateTimeUtil::newDateTime(FromDateEdit.dateValue(),0,DateTimeUtil::getCompanyTimeZone());
toDate = DateTimeUtil::newDateTime(ToDateEdit.dateValue()+1,0,DateTimeUtil::getCompanyTimeZone());
while select count(RecId) from serviceOrderTable
where serviceOrderTable.createdDateTime >= fromDate
&& serviceOrderTable.createdDateTime < toDate
fromDate = DateTimeUtil::newDateTime(FromDateEdit.dateValue(),0,DateTimeUtil::getCompanyTimeZone());
toDate = DateTimeUtil::newDateTime(ToDateEdit.dateValue()+1,0,DateTimeUtil::getCompanyTimeZone());
while select count(RecId) from serviceOrderTable
where serviceOrderTable.createdDateTime >= fromDate
&& serviceOrderTable.createdDateTime < toDate
This was originally posted here.

Like
Report
*This post is locked for comments