GetProcessesByQuery Method

First Added: GlobalCapture 2.3.0.124


Queries the MongoDB database for a list of Processes based on a query of combined ProcessFilters.

public List<Process> GetProcessesByQuery(List<ProcessFilter> query, QueryOperator queryOperator)

Classes: Database


Parameters

List<ProcessFilter> query

List of ProcessFilters combined to make a single query.

QueryOperator queryOperator

Logical operator used to connect the filters of the query.

Returns

List<Process>

List of process objects.


Example

The following example demonstrates combining executing a complex query by combining a few ProcessFilters in a list, and passing that list to the GetProcessesByQuery function. This particular query will return GlobalCapture processes from the workflow named "Example Workflow", that have a status of validation, and that have a name property of "John".

var query = new List<ProcessFilter>
{
    new PropertyFilter("Name", "John", PropertyComparator.Equals),
    new WorkflowNameFilter("Exasmple Workflow"),
    new StatusFilter(ProcessStatus.Validation),
    new ProcessTypeFilter(ProcessType.GlobalCapture)
};
return databaseHelper.GetProcessesByQuery(query, QueryOperator.And);

Remarks

If the parameters result in zero Processes found, an empty list will be returned.