Query in One Category |
Scroll |
The TheQuery class allows you to define and execute a document query in one category. It is conceptually similar to an SQL query with the following correspondences:
TheQuery |
SQL |
SELECT |
|
FROM |
|
WHERE |
|
ORDER BY |
The Step By Step guide and the examples below illustrate how to define and execute a typical document query. If you wish to search in more than one category pleas see "Query in Multiple Categories". "Process Query Results" explains how to process and iterate the result of a TheQuery.
1 |
Connect to the Thereforeâ„¢ server (see "Server - Connect and Disconnect" for Details) |
2 |
Declare and initialize a new TheQuery. |
3 |
Set a Category and Load it from the server (Comparable to SQL's FROM clause). |
4 |
Select the fields (columns) to be included in the results (Comparable to SQL's SELECT clause). |
5 |
Optional. Get a list of valid condition operators. (You can use these for defining conditions in step 6.) |
6 |
Specify conditions for your query (Comparable to SQL's WHERE clause) |
7 |
Set fields to sort results by (Comparable to SQL's ORDER BY clause). |
8 |
Execute the query on the server. |
9 |
Optional. Display query definition and results in a MessageBox. |
Requirements and Assumptions: Category number 5 with a string field number 70, string fields named "Supplier" and "InvoiceNo" and a field (of arbitrary type) named "Info". At least one document in that category matching the search criteria. If these assumptions do not apply to your system or configuration please replace them with appropriate values when copying the code samples below. |