Wednesday, 23 May 2012

'Like' and 'Not Like' in Dynamics AX query

In X++ you can use 'Like' to get the query result: E.g

static void Job12(Args _args)
{
    CustTable   custTable;
    ;
   
    while select custTable
        where custTable.AccountNum like "11*"
    {
       info(strfmt('%1', custTable.AccountNum));
    }
}

This job will return all the customer account starting from "11", as shown below:























In X++ you can use 'Not Like' to get the query result: E.g

static void Job13(Args _args)
{
    CustTable   custTable;
    ;
   
    while select custTable
        where !(custTable.AccountNum like "11*")
    {
       info(strfmt('%1', custTable.AccountNum));
    }
}

This job will return all the customer account NOT starting from "11", as shown below:

No comments:

Post a Comment