static void
AddORRangeToQuery(Args _args)
{
Query q =
new Query(); // Create a new
query.
QueryRun
qr;
CustTable
ct;
QueryBuildDataSource qbr1;
str strTemp;
;
qbr1 =
q.addDataSource(tablenum(CustTable));
// Name the datasource 'Customer'.
qbr1.name("Customer");
// Create a range value that designates an "OR"
query like:
// customer.AccountNum == "4000" ||
Customer.CreditMax > 2500.
qbr1.addRange(fieldNum(CustTable,
AccountNum)).value(strFmt('((%1.%2
== "4000") || (%1.%3 > 2500))',
qbr1.name(),
fieldStr(CustTable, AccountNum),
fieldStr(CustTable, CreditMax)));
// Print the data source.
print qbr1.toString();
info(qbr1.toString());
}
--> Replace OR operator with AND operator it will work as AND Operator in DynamicQuery.
AND
static void AddORRangeToQuery(Args _args)
{
Query q = new Query(); // Create a new query.
QueryRun qr;
CustTable ct;
QueryBuildDataSource qbds;
QueryBuildRange qbr1;
str strTemp;
;
qbds = q.addDataSource(tableNum(CustTable));
qbr1 = qbds.addRange(fieldNum(CustTable, AccountNum));
qbr1.value('4000');
qbr1 = qbds.addRange(fieldNum(CustTable,CustGroup));
qbr1.value('10');
info(qbds.toString());
}
No comments:
Post a Comment