Filter Scheme
This page explains the filter scheme feature, which controls how multiple conditions in a query filter are combined using AND and OR logic. By default, all conditions are combined with AND, but the scheme field lets you introduce OR logic for more flexible filtering.
Default Behaviour
By default, all conditions in a query filter are combined with AND. This means every condition must be met for a record to appear in the results. For example, if a filter has three conditions:
- Status = Active
- Category = Laptop
- Location = Head Office
Then only records that are Active AND in the Laptop category AND at Head Office will appear.
Introducing OR Logic
To use OR logic, manually edit the Scheme field in the filter editor. The scheme uses condition numbers (corresponding to their position in the condition list) combined with AND and OR operators.
Examples
| Scheme | Meaning |
|---|---|
1 AND 2 AND 3 |
All three conditions must be met (default behaviour) |
1 AND (2 OR 3) |
Condition 1 must be met, plus either condition 2 or condition 3 |
(1 OR 2) AND 3 |
Either condition 1 or condition 2 must be met, plus condition 3 |
1 AND 2 AND (3 OR 4 OR 5) |
Conditions 1 and 2 must be met, plus any one of 3, 4, or 5 |
Practical Example
To show assets that are either Laptops or Desktops at the Head Office:
- Condition 1: Location = Head Office
- Condition 2: Category = Laptop
- Condition 3: Category = Desktop
- Scheme:
1 AND (2 OR 3)
This returns all Head Office assets that are either Laptops or Desktops.
Rules and Warnings
- Always use parentheses to control evaluation order. Without them, AND takes precedence over OR, which may produce unexpected results. For example,
1 OR 2 AND 3is evaluated as1 OR (2 AND 3), not(1 OR 2) AND 3. - Condition numbers match position order. Condition 1 is the first condition in the list, condition 2 is the second, and so on.
- Update the scheme when conditions change. If you add or remove conditions after modifying the scheme, the condition numbers shift. Update the scheme to reflect the new numbering.
- If the scheme field is left empty, the default AND behaviour is used for all conditions.
Tip: For complex schemes, write out the logic in plain language first (e.g., "Show assets at Head Office that are either Laptops or Desktops and have a warranty expiring within 90 days"), then translate each clause into a condition and construct the scheme.
Warning: An incorrect scheme (e.g., referencing a condition number that does not exist, or having unbalanced parentheses) may cause the query to fail or return unexpected results. Always test the query after modifying the scheme.
Related Articles
- Query Record Filters — creating and editing filter conditions
- Queries and Reports — the query system overview
- Query Variants — each variant can have its own filter and scheme