How to use "Like" operator in the QueryBuildRange.Value


To make something as the "LIKE" operator in a query,  you should just assign a value to the queryRange including a wildcard.

The query framework will then change the statement into a LIKE statement. If the value does not contain a wildchard the query framework will change the statement to ==.


Example:

static void QueryBuildRange_Like(Args _args)
{
    Query                   query = new Query();
    QueryRun                queryRun;
    QueryBuildDataSource    queryDataSource;
    QueryBuildRange         queryRange;
    CustTable               custTable;
    ;


    queryDataSource = query.addDataSource(tablenum(CustTable));


    queryRange = queryDataSource.addRange(fieldnum(CustTable, Name));
 
    queryRange.value('The*');
 
    queryRun = new QueryRun(query);
    while (queryRun.next())
    {
        custTable = queryRun.get(tablenum(CustTable));
        info (custTable.Name);
    }
}



This posting is provided "AS IS" with no warranties, and confers no rights.

Skip to main content