Showing posts with label query run. Show all posts
Showing posts with label query run. Show all posts

Friday, November 7, 2008

LIKE statement in Dynamcis AX

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;
}

Tuesday, August 28, 2007

Query on table

Scenario:Can I use query on table; give some examples on exisitng tables;

Answer: Yes you can use queries on axapta tables like any other code. You can have a look at the InventSum table newQuery() method.

Friday, August 24, 2007

Getting number of recrods present in a query run

Scenario: I want to get the total number of records from a query run object. I will use them to generate a progress bar (progress indication framework).

Answer: Use SysQuery::countloop(qr). this will return the total number of records in a query object.