Question: How can we use like statement in Dynamics AX.
Answer: We can use 'like' clause in Dynamics AX statement by using '*' in the wild cards.
static void likeStatement(Args _args)
{
CustTable custTable;
;
while select custTable where custTable.Name like '*The*'
{
print custTable.Name;
}
pause;
}
In order to use linke statement in query use the '*' wild card in the query ranges. Something like the following,
static void likeQuery()
{
Query query = new Query();
QueryRun queryRun;
;
query.addDataSource(tableNum(CustTable)).addRange(fieldNum(CustTable, AccountNum)).value('400*');
queryRun = new QueryRun(query);
if(queryRun.next()) {
purchTable = queryRun.get(tableNum(CustTable));
print custTable.AccountNum;
pause;
}
I really like your blog and i really appreciate the excellent quality content you are posting here for free for your online readers. thanks peace claudia.
ReplyDelete