Set Filters
Set filters compare the result of the current path step with the result of its closest earlier step of the same type. “Same type” means that both steps must return rows from the same table. If no earlier step of the same type exists, the UI will not allow adding a set filter.
A separate article provides a full introduction to set operations.
Purpose
Set filters are used when a classification depends on how two sets of rows relate to each other, rather than on properties of individual rows. They enable rules that involve matching, overlap, or differences between collections of related rows.
Why Set Filters Are Needed
Some rules cannot be expressed by checking each row independently. Instead, the system must compare one collected set of rows with another. This happens when correctness depends on whether sets match, intersect, or differ.
Examples:
- Region alignment: A representative should only serve customers belonging to the same region. This requires checking whether the region sets for the representative and the customer overlap or match.
- Allowed values: A product’s categories must belong to the set of categories allowed for its group. This requires verifying that one set is contained within another.
- Shared membership: A person should share at least one address with their household. This requires checking if two address sets intersect.
Set filters provide these comparisons directly on the path.
Supported Set Operations
Set filters apply one of the following operations between:
- A = the current step’s result set
- B = the closest earlier same-type step’s result set
Supported operations:
- Union (A ∪ B)
- Intersection (A ∩ B)
- Difference (A − B)
- Difference (B − A)
- All in A
- All in B
- Symmetric Difference (A Δ B)
No additional semantics are applied beyond the chosen set operation.