Use the null value of querybuildrange

Source: Internet
Author: User

However, it is best to use sysquery: valueemptystring () for future scalability of the system to avoid changing the meaning of null values in the future.
Sysquery: valueemptystring (); the comment on this method also shows that the reason for encapsulating vacant space into a method is for future compatibility.

When the value attribute of querybuildrange is used, if the value is '', the query ignores the range, as if there is no such range. For example, the following statement:

In this way, the same effect can be achieved.

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;

}

What should I do if I want to query a field whose value is? In this case, sysquery: valueemptystring (); is used as follows:

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;

}

 

 

Static void emptytest ()
{
Query Q;
Queryrun QR;

Custtable Cust;
;
Q = new query ();
Q. adddatasource (tablenum (custtable). addrange (fieldnum (custtable, accountnum). Value (Queryvalue (''));
Qr = new queryrun (Q );
While (QR. Next ())
{
Cust = QR. Get (tablenum (custtable ));
Box: Info (Cust. Address );
}
Pause;

}

 

 

You can also directly use escape characters, such:

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;

}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.