OR Condition through Query Framework

In recent times many of my colleagues have come to me asking for having an OR condition in query framework here is a small example to achieve the same.
static void queryORCondtion(Args _args)
    Query           q;
    Queryrun        qr;
    CustTable       ct;
    str range;
    q = new query();
    range = strfmt(‘((%1 == "4000") || (%2 == "20"))’, fieldstr(CustTable, AccountNum), fieldstr(CustTable, CustGroup));
    q.dataSourceNo(1).addRange(fieldNum(CustTable, AccountNum)).value(range);
    qr = new QueryRun(q);
    while (qr.next())
         ct = qr.getNo(1);
    info (qr.query().dataSourceNo(1).toString());

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s