Common Filter Patterns
A collection of frequently used filter patterns for Precision Bridge. Each example shows the filter configuration (field, operator, value) and explains the use case.
Date-Based Filters
Important: Always use
date()ordatetime()functions when comparing against date and datetime fields. Do not pass raw date strings — PB needs proper date objects to translate them into the source system's format.
1. Records from the last 30 days
| Field | Operator | Value |
|---|---|---|
sys_created_on |
Greater Than | datetime.now() - timedelta(days=30) |
Extracts only records created in the last 30 days. The value is a formula expression — toggle the formula switch on.
2. Records from the last 90 days
| Field | Operator | Value |
|---|---|---|
sys_updated_on |
Greater Than | datetime.now() - timedelta(days=90) |
Useful for incremental migrations targeting recently changed records.
3. Records created after a specific date
| Field | Operator | Value |
|---|---|---|
sys_created_on |
Greater Than | datetime(2024, 1, 1) |
Use datetime() for datetime fields or date() for date-only fields.
4. Records within a date range
| Field | Operator | Value | Connector |
|---|---|---|---|
sys_created_on |
Greater Than or Equal To | datetime(2024, 1, 1) |
AND |
sys_created_on |
Less Than | datetime(2025, 1, 1) |
Extracts records from all of 2024.
5. Incremental / delta migration (since last run)
| Field | Operator | Value |
|---|---|---|
sys_updated_on |
Greater Than | LAST_EXECUTION_TIMESTAMP |
References the built-in system variable that holds the start time of the previous successful run. Updated automatically by the platform — no procedure input variable or external persistence required. Empty on the first run; combine with the Override switch on the variable, or with a formula fallback such as LAST_EXECUTION_TIMESTAMP or datetime(2000, 1, 1, tzinfo=timezone.utc), to handle the first run cleanly. See Using Variables in Filters.
Status and State Filters
6. Active records only
| Field | Operator | Value |
|---|---|---|
active |
Is Equal To | true |
The most common filter — excludes inactive or retired records.
7. Records in specific states
| Field | Operator | Value |
|---|---|---|
state |
In | [1, 2, 3] |
The In operator takes a Python list. Toggle the formula switch on so the value is evaluated as an expression. This extracts records in states 1, 2, or 3.
8. Exclude closed records
| Field | Operator | Value |
|---|---|---|
state |
Is Not Equal To | 7 |
Extracts everything except records in state 7 (Closed).
9. Multiple status exclusions
| Field | Operator | Value | Connector |
|---|---|---|---|
state |
Is Not Equal To | 7 |
AND |
state |
Is Not Equal To | 8 |
Excludes both Closed (7) and Cancelled (8) records.
Text-Based Filters
10. Records matching a category
| Field | Operator | Value |
|---|---|---|
category |
Is Equal To | Hardware |
Exact match on a category field.
11. Records containing a keyword
| Field | Operator | Value |
|---|---|---|
short_description |
Contains | network |
Substring match — extracts records where the description contains "network".
12. Records NOT containing a keyword
| Field | Operator | Value |
|---|---|---|
short_description |
Does Not Contain | test |
Excludes test records from the migration.
13. Records with non-empty fields
| Field | Operator | Value |
|---|---|---|
assigned_to |
Is Not Null |
Extracts only records that have an assigned user. Useful for ensuring data completeness.
14. Records with empty fields
| Field | Operator | Value |
|---|---|---|
resolution_notes |
Is Null |
Finds records missing resolution notes — useful for data quality checks.
Reference Field Filters
15. Records assigned to a specific user
| Field | Operator | Value |
|---|---|---|
assigned_to |
Is Equal To | 6816f79cc0a8016401c5a33be04be441 |
Filters by the user's sys_id. Useful for testing with a single user's records.
16. Records in a list of categories
| Field | Operator | Value |
|---|---|---|
category |
In | ["Hardware", "Software", "Network"] |
Extracts records in any of the listed categories. Toggle the formula switch on so the value is evaluated as a Python list expression.
Variable-Based Filters
17. Filter by a procedure input variable
| Field | Operator | Value |
|---|---|---|
number |
Is Equal To | incident_number |
References the procedure variable incident_number. Useful for testing with a single record.
18. Filter using a list variable
| Field | Operator | Value |
|---|---|---|
sys_id |
In | list(id_map.keys()) |
Uses a formula expression to extract the keys from a dictionary variable. Toggle the formula switch on.
19. Filter child records by parent IDs
| Field | Operator | Value |
|---|---|---|
element_id |
In | list(incident_id_map.keys()) |
Extracts journal entries only for incidents in the ID map. This is the manual equivalent of what child filter auto-configuration does automatically.
Combined Filters
20. Active high-priority incidents from the last year
| Field | Operator | Value | Connector |
|---|---|---|---|
active |
Is Equal To | true |
AND |
priority |
In | [1, 2] |
AND |
sys_created_on |
Greater Than | datetime.now() - timedelta(days=365) |
Combines status, priority, and date filters.
21. OR logic: multiple categories
| Group | Field | Operator | Value | Connector |
|---|---|---|---|---|
| 1 | category |
Is Equal To | Hardware |
OR |
| 1 | category |
Is Equal To | Software |
Equivalent to using the In operator but shown for illustration. Prefer In when matching against a list of values.
22. Nested AND/OR groups
| Group | Field | Operator | Value | Connector |
|---|---|---|---|---|
| 1 | active |
Is Equal To | true |
AND |
| 2 (OR group) | priority |
Is Equal To | 1 |
OR |
| 2 (OR group) | priority |
Is Equal To | 2 |
Extracts active records that are either Priority 1 or Priority 2.
23. Exclude test data
| Field | Operator | Value | Connector |
|---|---|---|---|
short_description |
Does Not Contain | TEST |
AND |
short_description |
Does Not Contain | test |
AND |
category |
Is Not Equal To | Testing |
Removes test records from the migration by filtering out common test markers.
Testing Filters
24. Single record for development
| Field | Operator | Value |
|---|---|---|
number |
Is Equal To | INC0010001 |
Extracts exactly one record. Ideal for developing and testing field mappings before running a full migration.
25. Small sample by date range
| Field | Operator | Value | Connector |
|---|---|---|---|
sys_created_on |
Greater Than | datetime(2024, 6, 1) |
AND |
sys_created_on |
Less Than | datetime(2024, 6, 8) |
Extracts one week of records — a manageable sample for validation.
Tips
-
Always use
date()ordatetime()for date comparisons — raw strings like'2024-01-01'will not be translated correctly to the source system's format. -
Use
Ininstead of multiple OR conditions when matching against a list of values — it's cleaner and more efficient. - Start with a narrow filter during development (e.g., single record), then broaden for testing, then remove or widen for production.
- Use formula toggle when the value should be evaluated as an expression (variables, function calls, arithmetic).
Related Documentation
- Filter Operators — Complete operator reference
- Combining Conditions — AND, OR, NOT, and nesting
- Using Variables in Filters — Parameterized filters
- Formulas in Filters — Formula expressions as filter values
- Native Query Filters — Raw query strings for advanced use cases
- date() — Date constructor reference
- datetime() — Datetime constructor reference
- timedelta() — Duration for date arithmetic
Comments
0 comments
Please sign in to leave a comment.