Tuesday, March 18, 2014

OR Condition through Query Framework

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();
q.addDataSource(tablenum(CustTable));

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(ct.AccountNum);
}

info (qr.query().dataSourceNo(1).toString());
}

No comments:

Post a Comment