Skip to main content

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

ParameterTypeRequiredVariableDescription
filterConditionsarrayNoNoList of filter conditions. Items matching the conditions are kept.
filterModechoice (include, exclude)NoNoFilter mode: include (keep matches) or exclude (remove matches). (Default: "include")
inputArraydynamic valueNoYesInput array to filter. Can reference a previous block output.
outputVariabletextNoNoOutput 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

ProblemSolution
The filter returns an empty arrayCheck 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.