GUBUS FILTER
GUBUS FILTER removes objects from localObjs that do not meet specified filter conditions, supporting 20+ commands and AND logic.
GUBUS FILTER
Overview
FILTER removes objects that don’t meet specified conditions. Objects failing any filter check are excluded from localObjs.
Key characteristics:
- 20+ filter commands for various checks
- Multiple filters with same
referenceallowed = AND logic (all must pass) to be kept in local objs - Objects without required
field_nameautomatically fail
How It Works
[For each object in localObjs]
→ Check field_name value against filter_command + field_value
→ If fails: Remove from localObjs
→ If passes: Keep object
All filters with matching reference execute sequentially. Object must pass ALL filters to remain.
Filter Commands
Type Checks
| COMMAND | PURPOSE | Needs field_value |
|---|---|---|
| CHECK_IS_STRING | Keep if field is string | No |
| CHECK_IS_NUMBER | Keep if field is number | No |
| CHECK_IS_POSITIVE_NUMBER | Keep if field > 0 | No |
Equality Checks
| COMMAND | PURPOSE | Needs field_value |
|---|---|---|
| CHECK_EQUALS | Keep if field == field_value | Yes |
| CHECK_NOT_EQUALS | Keep if field != field_value | Yes |
| CHECK_IN | Keep if field in “val1,val2,val3” | Yes |
| CHECK_NOT_IN | Keep if field NOT in list | Yes |
Presence Checks
| COMMAND | PURPOSE | Needs field_value |
|---|---|---|
| CHECK_IS_PRESENT | Keep if field exists and not empty | No |
| CHECK_NOT_PRESENT | Keep if field missing or empty | No |
| CHECK_NOT_PRESENT_OR_FALSY | Keep if missing/empty/null/false | No |
String Checks
| COMMAND | PURPOSE | Needs field_value |
|---|---|---|
| CHECK_STARTS_WITH | Keep if field starts with value | Yes |
| CHECK_HAS_STRICT_LENGTH | Keep if field.length == value | Yes |
Special Checks
| COMMAND | PURPOSE | Needs field_value |
|---|---|---|
| CHECK_NOT_GOOGLE_MISTAKE | Exclude #DIV/0!, #VALUE!, #REF!, #NAME?, #N/A, #NUM! | No |
| CHECK_IS_TRUE | Keep if field === true | No |
Rule Properties
| PROPERTY | DESCRIPTION |
|---|---|
| reference | Links filter rules. All with same reference execute together |
| field_name | Field to check. Example: “status” |
| filter_command | Command from table above |
| field_value | Value for comparison (required for most commands) |
| stop_here_if_true | Boolean. Skip remaining filters if this passes |
| message | Custom message for logging |
Use Cases
Filter Completed Orders
{
"reference": "getCompleted",
"field_name": "status",
"filter_command": "CHECK_EQUALS",
"field_value": "completed"
}
Input: [{status: "completed"}, {status: "pending"}, {status: "completed"}]
Output: Only objects with status: "completed"
Clean Google Errors + Validate Type
[
{"reference": "clean", "field_name": "qty", "filter_command": "CHECK_NOT_GOOGLE_MISTAKE"},
{"reference": "clean", "field_name": "qty", "filter_command": "CHECK_IS_POSITIVE_NUMBER"}
]
Input: [{qty: 10}, {qty: "#DIV/0!"}, {qty: -5}, {qty: 20}]
Output: [{qty: 10}, {qty: 20}]
Both filters must pass (AND logic).
Multi-Value Match
{
"field_name": "status",
"filter_command": "CHECK_IN",
"field_value": "completed,shipped,delivered"
}
Keeps objects where status is ANY of the listed values.
Troubleshooting
All objects removed: Verify field_name exists, check filter_command logic, test with single filter.
Not filtering: Check reference matches schema config, verify filter_command spelling, ensure field_value type matches field type.
Unexpected AND results: Remember same reference = ALL must pass.
Use gubus_debug: to see obj state before/after filters.
Summary
FILTER removes objects not meeting conditions:
- 20+ commands for type/equality/presence/string checks
- AND logic for multiple filters (same reference)
- Failed objects permanently removed
When to use: Relevant data for particular schema filtering, subset extraction, error exclusion