Use JavaScript to implement an advanced combination query control (with a preliminary implementation prototype)

Source: Internet
Author: User

In many projects, especially information systems, query functions account for a large part of the project, and the combination of query conditions is rich, so it becomes complex to achieve. In general, we will only implement a limited condition query, such as a table of some important fields or even all of the fields; Of course, in the case of a regular customer is sufficient, but some advanced applications such as ((field 1>10) or (field 2=5)) and field 3 is not null) This complex combination of conditions is not necessarily appropriate, usually if it is fixed several combinations of patterns, so we can also be in the background in the language (Java, C #, etc.) to achieve, if the combination of conditions is dynamic, then the implementation is quite troublesome.

So in order to achieve dynamic conditional combination, summed up some previous project experience, wrote an advanced combination query control prototype, as follows:

Of course, the generated conditions are not all the database can pass, such as Oracle, their date query requirements with to_date () conversion, but as long as the extension can be achieved, hehe;

SOURCE download

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.