Monday 9 November 2015

How to use QueryFilter of Dynamics Ax?

How to use Full text with character? How to filter the data using LIKE in Ax? How to filter the name exluding all spaces?


 

There is one class QueryFilter available in AX to filter the query very easily.


QueryBuildDataSource qbds;
QueryFilter qFilter;

Counter i;
Array results = new Array(Types::String);
str spltName;



qbds = _query.dataSourceTable(tableNum(DirPartyTable));
qbds.addSortIndex(indexNum(DirPartyTable, NameIdx));
qbds.indexIsHint(true);

results = strSplit2Array('Dynamics Ax 1',' ');

for (i = 1; i <= results.lastIndex(); i++)
{
  spltName = results.value(i);
 
 qFilter = _query.addQueryFilter(qbds, 'Name');
  qFilter.value(SysQuery::valueLike(spltName));
}

Here Output will be all the related records which include Dynamics or Ax or 1.
 
Output:
 
Dynamics ax
Dynamics 11
111
axapta
Dynamics123
 

           

No comments:

Post a Comment