Find Instances of a Specific Process |
Scroll |
Besides searching for documents, the TheQuery class can also be used to find all running and/or finished instances of a specified process. The guide and code sample below illustrates a typical workflow query. The reference page of the ExecuteWorkflowQuery method contains more details on parameters and usage.
If you want to get all instances of all workflow processes use the GetAllWorkflowInstances method described in the "Find Instances of All Processes" guide.
1 |
Connect to the Thereforeā¢ server (see "Server - Connect and Disconnect" for Details) |
2 |
Declare and initialize a new TheQuery. |
3 |
Call ExecuteWorkflowQuery to run the query on the server. |
4 |
Optional. Display the results in a MessageBox. |
Requirements and Assumptions: Process number 1 exists in your Thereforeā¢ system. 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. Create a new query Dim wfQuery As New TheQuery
' 3. Execute the query on the server Dim wfResult As TheQueryResult = wfQuery.ExecuteWorkflowQuery ( _ 1, TheWorkflowFlags.AllInstances, server )
' Optional 4. Display the results in a messageBox System.Windows.Forms.MessageBox.Show(wfResult.ToString()) C# using Therefore.API; //...
// 1. Connect to the Thereforeā¢ server TheServer server = new TheServer(); server.Connect(TheClientType.CustomApplication);
// 2. Create a new query TheQuery wfQuery = new TheQuery();
// 3. Execute the query on the server TheQueryResult wfResult = wfQuery.ExecuteWorkflowQuery( 1, TheWorkflowFlags.AllInstances, server);
// Optional 4. Display the results in a messageBox System.Windows.Forms.MessageBox.Show(wfResult.ToString()); |