Queries are used to filter information displayed based on certain criteria. For example, you can set a query on your Matters Browse so that it will only show open matters, and filter out any closed matters.
Queries are used in many areas of the software, but are most commonly used on your Names, Events, and Matters browses, and to filter the results of reports.
This article demonstrates how to add a new query from the Report Control window, but the same steps apply from other windows where queries can be set.
Creating a New Query
- Navigate to File > Reports, and click the option that corresponds to the kind of report that you would like to create a query for (e.g. if you would like to filter the results on a report with case information, click Matters).
- Click Query, then Query Manager.
- Click Add to add a new query, or highlight an existing query that you would like to use as a template, and click Clone to create a copy of it that you can edit.
- Enter your desired Query ID. The ID can be up to 8 characters.
- Enter a Description (optional).
Designing the Query
The main view on the Query Builder Screen shows the “expressions” (lines) within the query. Each expression specifies a condition to be used for the query.
There are two ways to add a new expression to the list:
- Add: This adds a new expression to the end of the list of expressions.
- Insert: This adds a new expression just above the one currently highlighted. This is useful if you need a condition to be included with a condition further up the list using the and connector (see below) .
While AbacusLaw allows you to add as many expressions as you would like, queries become unreliable when they include too many expressions. They may either generate unexpected results, or cause a run-time error and crash when trying to use them. For this reason, we do not recommend including more than NINE (9) expressions in a single query. If you have more than nine expressions and are experiencing odd results or crashes, reduce the number of expressions.
When you either add or insert a new expression, the Expression Editor appears. From here, you set the following:
- Field: The field that you want to make the comparison on (Case code, when, etc.). When you click the Lookup button and are viewing the fields list, you can change the Database at the top right, so that you can query fields from linked records (e.g. linked names on a matter), rather than the main record.
Your mileage may vary when querying fields from other databases. Since it is not possible to specify what linked record to query, the results may not be what you expect. Specifying multiple cross-database expressions on the same query can also exacerbate this issue, or cause validation errors to occur.
- Comparison: The way that the field's value is compared to the value you specify. To change, click the lookup button and select the comparison operator you want to use to create the expression.
- Value: The value that you are comparing the field to. This field can be left blank if the comparison is is empty or is not empty.
When there are multiple expressions in a query, you must choose to connect them with either and or or. This determines how the query tests for the expression.
And: If two expressions are connected using and, BOTH expressions' conditions must be true on the record being tested, otherwise the record will not be included in the query.
Or: If the expressions are connected using or, EITHER expression's condition can be true on the record being tested, and the record will be included in the query.
To set the connector:
When adding a new expression, you will be prompted to pick the connector.
If you would like to change the connector later, highlight the expression, then click and/or.
When in the Expression Editor, you are able to put a parenthesis to the left or to the right of the expression. You can use this to group expressions that are related together. This is optional, and does not typically modify the results. However, it may make it easier to read, and can change the results of the query under certain conditions, such as if you are trying to check if a group of expressions is true, and connect it with another expression or group as a whole.
Running the Query
- When you have finished crafting your query, click Done on the Query Builder window.
- If you would like to test how many records match the query, click Count on the Queries window.
- To apply the query, click Done on the Queries window.