Search This Blog

Monday, September 19, 2011

Expressions in QueryRanges

static void krishh_ExpressionInQuery(Args _args)
{
    Query q = new Query(); 
    QueryRun qr;
    CustTable ct;
    QueryBuildDataSource qbr1;
    ;
    qbr1 = q.addDataSource(tablenum(CustTable));
    qbr1.name("Customer");
    qbr1.addRange(fieldNum(CustTable, AccountNum)).value(
    strFmt('((%1.%2 == "4000") || (%1.%3 == "The Bulb"))',
        qbr1.name(),
        fieldStr(CustTable, AccountNum),
        fieldStr(CustTable, Name)));
       info(qbr1.toString());
    qr = new QueryRun(q);
    while (qr.next())
    {
        if (qr.changedNo(1))
        {
            ct = qr.getNo(1);
            info(strfmt('CustomerAccountNum=%1 And Customer Name=%2',ct.AccountNum,ct.Name));
        }
    }
}

1 comment:

  1. Hi krish,

    i need C# version of this code for date fields
    please send me
    balachandargopal@gmail.com

    Thanks
    Balachandar G

    ReplyDelete

Thanks for visiting my blog,
I will reply for your comment within 48 hours.

Thanks,
krishna.