Thursday, 13 April 2017

Query Range more than one Value in x++ Query

static void queryMultipleValue(Args _args)
{
    Query                   query;
    QueryRun                queryrun;
    QueryBuildDataSource    qbds;
    QueryBuildRange         qbr, qbr1;
    SalesTable              salesTable;
    str                     rangevalue;
    ;

    query = new Query();

    qbds = query.addDataSource(tableNum(SalesTable));
    qbds.addSortField(fieldNum(SalesTable, CustAccount), SortOrder::Ascending);
    qbr     = qbds.addRange(fieldNum(SalesTable, CustAccount));

   
    qbr.value(strFmt("%1,%2,%3", queryValue("US-4000"), queryValue("US-027"), queryValue("US-028")));
 

    queryrun = new QueryRun(query);


    info(strFmt(queryrun.toString()));
    while(queryrun.next())
    {
        salesTable = queryrun.get(tableNum(SalesTable));

        info(strFmt("%1", salesTable.CustAccount));
    }
}

1 comment: