
Overview
The Filter Block allows you to filter an array based on a corresponding array of boolean values. It takes an array of any data type and an array of boolean values of the same length, then outputs a new array containing only the elements where the corresponding boolean value istrue.
This block is particularly useful for filtering arrays based on specific conditions, especially when combined with other blocks like Compare in a batched operation.
Inputs
The array to be filtered. Non-array inputs will be coerced into an array.
An array of boolean values indicating whether to include each element in the array. The length of this array should match the length of the array input.
Outputs
The filtered array, containing only the elements where the corresponding boolean value in the include input was
true. The output maintains the data type of the input array.Example: Filter numbers greater than 3
- Create an Array Block with values
[1, 2, 3, 4, 5]. - Add a Compare Block, set comparison to
>, and enable batching. - Create a Number Block with value
3. - Connect the Array Block to Compare Block’s
Ainput, and Number Block toBinput. - Add a Filter Block, connect Array Block to
arrayinput and Compare Block’sResulttoincludeinput. - Run the flow. The Filter Block’s
filteredoutput should be[4, 5].
Error Handling
The Filter Block will error if:- The
arrayorincludeinputs are not provided - The lengths of the input arrays do not match
FAQ
What happens if the lengths of the array and include inputs do not match?
What happens if the lengths of the array and include inputs do not match?
The Filter Block will error. The lengths of the array and include inputs should always match.
Can I use the Filter Block to filter an array of objects?
Can I use the Filter Block to filter an array of objects?
Yes, you can use the Filter Block to filter an array of any data type, including objects. Just make sure to provide an array of boolean values indicating whether to include each object in the filtered array.


