Thursday, January 28, 2010

"Not Like and Like" Operator in Dynamics AX

Use of "Not Like and Like" operator through Dynamics Ax Query.

static void RAJ_LikeNotLikeOperator(Args _args)
{
Query query = new Query();
QueryRun queryRun;
InventTable inventTable;
;

query.addDataSource(tableNum(InventTable)).addRange(fieldNum(InventTable, ItemId)).value("100*"); // Like operator
// query.addDataSource(tableNum(InventTable)).addRange(fieldNum(InventTable, ItemId)).value("!100*"); // Not Like Operator
queryRun = new QueryRun(query);
while(queryRun.next())
{
inventTable = queryRun.get(tableNum(InventTable));
info(inventTable.ItemId);
}
}

No comments: