QueryBuildRange的空值
在用QueryBuildRange的value属性时,如果value的值是‘’,则查询会忽略该Range,好像没有这个Range一样,比如如下语句:
static void EmptyTest()
{
Query q;
QueryRun qr;
CustTable cust;
;
q = new Query();
q.addDataSource(tableNum(custtable)).addRange(fieldnum(custtable,accountnum)).value('');
qr = new QueryRun(q);
while(qr.next())
{
cust = qr.get(tablenum(custtable));
box::info(cust.Address);
}
pause;
}
如果想查询某个字段的值为‘’值的该怎么处理那?这就需要用到SysQuery::valueEmptyString();如下所示:{
Query q;
QueryRun qr;
CustTable cust;
;
q = new Query();
q.addDataSource(tableNum(custtable)).addRange(fieldnum(custtable,accountnum)).value('');
qr = new QueryRun(q);
while(qr.next())
{
cust = qr.get(tablenum(custtable));
box::info(cust.Address);
}
pause;
}
static void EmptyTest()
{
Query q;
QueryRun qr;
CustTable cust;
;
q = new Query();
q.addDataSource(tableNum(custtable)).addRange(fieldnum(custtable,accountnum)).value(SysQuery::valueEmptyString());
qr = new QueryRun(q);
while(qr.next())
{
cust = qr.get(tablenum(custtable));
box::info(cust.Address);
}
pause;
}
{
Query q;
QueryRun qr;
CustTable cust;
;
q = new Query();
q.addDataSource(tableNum(custtable)).addRange(fieldnum(custtable,accountnum)).value(SysQuery::valueEmptyString());
qr = new QueryRun(q);
while(qr.next())
{
cust = qr.get(tablenum(custtable));
box::info(cust.Address);
}
pause;
}