General X++ Development
How do I select records between two dates in X++?
How do I select records between two dates in X++?
1 answer
Write an answerUse normal comparison operators.
TransDate fromDate = mkDate(1, 1, 2026);
TransDate toDate = mkDate(31, 1, 2026);
CustTrans custTrans;
while select custTrans
where custTrans.TransDate >= fromDate
&& custTrans.TransDate <= toDate
{
info(custTrans.Voucher);
}For a utcdatetime field, use utcdatetime values instead of date values so you do not accidentally lose the time portion.
Know the solution?
Sign in to contribute an answer and build your community reputation.
Sign in to answer