Microsoft Dynamics Ax developer's blog

Monday, April 23, 2007

SYS_ExpressionQueryBuilder

SYS_ExpressionQueryBuilder is an ExpressionBuilder for queries. Read more @ axaptapedia

InventTrans inventTrans;
QueryRun qr = SYS_ExpressionQueryBuilder::construct()
.dataSource(tableNum(InventTrans))
.count(fieldNum(InventTrans, RecID))
.groupBy(fieldNum(InventTrans, ItemID))
.between(fieldNum(InventTrans, DatePhysical), 01012006, 31122006)
.matches(fieldNum(InventTrans, Qty), '<0')

.exists(tableNum(InventDim))
.link(fieldNum(InventTrans, InventDimID),
fieldNum(InventDim, InventDimID))
.matches(fieldNum(InventDim, InventLocationID), condition)
.run();
;
while(qr.next())
{
inventTrans = qr.get(tableNum(InventTrans));
info(strFmt('%1: %2', inventTrans.ItemId, InventTrans.RecId));
}

No comments: