Skip to main content

Array Filter

This node creates a new array containing only items that match specific criteria.

The Array Filter node provides powerful filtering, sorting, and pagination capabilities for collections.

The Array Filter node takes an input array and applies a set of rules to produce a new, filtered array. It can filter by property values (equals, greater than, regex, etc.), sort the results, and limit the number of items returned. This is essential for search functionality, lists, and data management.

Inputs

General

DataDescription
ItemsThe source array to filter.
EnabledIf false, the node passes the original array through without filtering. Default: true.

Filter

DataDescription
FilterA list of property keys to filter by. Adding a key here creates dynamic inputs for that filter (e.g., "Type", "Op", "Value").

Sort

DataDescription
SortA list of property keys to sort by. Adding a key creates dynamic inputs to choose Ascending/Descending.

Limit

DataDescription
Use limitBoolean. If true, enables Limit and Skip inputs.
LimitMax number of items to return.
SkipNumber of items to skip (for pagination).

Actions

SignalDescription
FilterManually triggers the filter operation. If not connected, the node updates automatically when inputs change.

Outputs

General

DataDescription
ItemsThe resulting filtered array.
CountThe number of items in the filtered result.
First Item IdThe ID of the first item in the filtered result.

Events

SignalDescription
FilteredTriggered when the filter operation completes.

Usage

Dynamic Filtering Ports

When you add a property name (e.g., "category") to the Filter list input, the node adds three new inputs:

  1. Type: String, Number, or Boolean.
  2. Op: The operator (Equals, Not Equals, Greater Than, Regex, etc.).
  3. Value: The value to compare against.

Example Use Cases

  1. Search Bar:
    • Add "name" to Filter.
    • Set Op to "Matches RegEx".
    • Connect Search Input text to Value.
  2. Price Range:
    • Add "price" to Filter.
    • Set Op to "Less than".
    • Set Value to 100.
  3. Pagination:
    • Enable Use limit.
    • Set Limit to 10.
    • Connect a variable (Page * 10) to Skip.

Detailed Behavior

  1. Auto-Update: Unless the Filter signal input is connected, the node reacts immediately to changes in the source Items or any filter parameter.
  2. Chaining: Operations happen in order: Filter -> Sort -> Skip -> Limit.
  3. Regex: The "Matches RegEx" operator allows for partial string matching (like "contains"). Use the "Case sensitive" option for precision.

Troubleshooting

  • No Results: Check your filter logic. Ensure the property names in Filter exactly match the keys in your object data.
  • Wrong Sort: Ensure the property you are sorting by actually exists on the objects.