Simple Query |
Scroll |
The pseudo-static ExecuteSimple method of the TheQuery class allows you to conveniently specify a document query if your query meets the following conditions:
The query is executed in a single category (not a multi-query)
Conditions are specified for at most one category field.
Results are to be sorted by at most one category field.
If your query does not meet these conditions, you have to specify and execute a regular query. See "Query in One Category" and/or "Query in Multiple Category" for detailed instructions.
1 |
Connect to the Thereforeā¢ server (see "Server - Connect and Disconnect" for Details) |
2 |
Create a new temporary TheQuery and call the ExecuteSimple method. Consider declaring a (static) TheQuery member if you plan on using ExecuteSimple fequently. Please consult the documentation of the ExecuteSimple method for more information on parameters and usage. |
3 |
Optional. Display a message box with the results. |
Requirements and Assumptions: Category number 5 with string field 70. At least one document in that category where the field 70 value starts with a "3" (otherwise the results are empty). If these assumptions do not apply to your system or configuration please replace them with appropriate values when copying the code samples below. Visual Basic Imports Therefore.API '...
' 1. Connect to the Thereforeā¢ server Dim server As New TheServer server.Connect(TheClientType.CustomApplication)
' 2. Call the ExecuteSimple of a temporary TheQuery instance ' Finds index data in category 5 where field 70 starts with a "3" ' and sorts the results by the value of field 70. Dim result As TheQueryResult = _ New TheQuery().ExecuteSimple(5,70,"3*",70,server)
' Optional 3. Display a message box with the results. System.Windows.Forms.MessageBox.Show(result.ToString()) C# using Therefore.API; //...
// 1. Connect to the Thereforeā¢ server TheServer server = new TheServer(); server.Connect(TheClientType.CustomApplication);
// 2. Call the ExecuteSimple of a temporary TheQuery instance // Finds index data in category 5 where field 70 starts with a "3" // and sorts the results by the value of field 70. TheQueryResult result = new TheQuery().ExecuteSimple(5, 70, "3*", 70, server);
// Optional 3. Display a message box with the results. System.Windows.Forms.MessageBox.Show(result.ToString()); |
Pseudo-Static Method This method does not read or write any member variables of the class it belongs to and should be used like a static method. Unfortunately, Component Object Model (COM) interfaces do not support the concept of static methods. You may declare a temporary instance when using the method once or create a singleton or static member in the calling class if you plan on using it frequently. |