HOW TO USE "LIKE" OPERATOR IN QUERYBUILDRANGE

To make something as the LIKE operator in a query, just assign a value to the QueryRange including a wildcard.

static void QueryBuildRange_Sample(Args _args)
{
    Query                       query = new Query();
    QueryRun                    queryRun;
    QueryBuildDataSource        qbds;
    QueryBuildRange             queryRange;   
    CustTable                   custTable;
    
    qbds.addDataSource(tableNum(CustTable));
    
    queryRange = qbds.addRange(fieldNum(CustTable, AccountNum));
    
    queryRange.value("axd*");
    
    queryRun = new QueryRun(query);
    
    while(queryRun.next())
    {
        custTable = queryRun.get(tableNum(CustTable));
        print custTable.AccountNum;
    }
    pause;
}

Max Nguyen

Max Nguyen
MCP - Microsoft Dynamics AX Technical Consultant, currently living and working in Seoul, S.Korea :)

Exception Handling in Dynamics 365 For Finance and Operation

When we write a code, or make a customization to Dynamics 365 For Operation which is using X++ should make use of Exception Handling to p...… Continue reading

Basic C# OOP Concept

Published on April 11, 2017