Filtre
Filters an array based on one or more conditions (AND/OR). Returns matching elements with detailed statistics (original count, filtered, removed). The main field is data (not results).
Parameters
| Parameter | Type | Required | Variable | Description |
|---|---|---|---|---|
filterConditions | array | No | No | List of filter conditions. Items matching the conditions are kept. |
filterMode | choice (include, exclude) | No | No | Filter mode: include (keep matches) or exclude (remove matches). (Default: "include") |
inputArray | dynamic value | No | Yes | Input array to filter. Can reference a previous block output. |
outputVariable | text | No | No | Output variable name containing the filtered items. |
Parameters marked Variable = Yes accept the
{{blockName.field}}syntax.
Output
Output variable : filteredData
{
"success": false,
"data": [],
"filtered": [],
"originalCount": 0,
"filteredCount": 0,
"removedCount": 0,
"metadata": {}
}
Example
Keep only entities with an active status.
Input :
{"items": [{"name": "A", "status": "active"}, {"name": "B", "status": "inactive"}, {"name": "C", "status": "active"}]}
Output :
{"success": true, "data": [{"name": "A", "status": "active"}, {"name": "C", "status": "active"}], "originalCount": 3, "filteredCount": 2, "removedCount": 1}
Common errors
| Problem | Solution |
|---|---|
| The filter returns an empty array | Check the field names in your conditions. Valid operators are: equals, not_equals, contains, not_contains, starts_with, ends_with, greater_than, less_than, gte, lte, is_null, is_not_null, in, not_in. |
Tip
Use {{filteredData.data}} for the filtered array (not {{filteredData.results}}). {{filteredData.filteredCount}} gives the number of retained elements.