FilterAdvanced icon

FilterAdvanced

Remove items matching a condition

Overview

The FilterAdvanced node is designed to filter input items based on a set of user-defined conditions. It allows you to specify multiple conditions across different data types (Boolean, Date & Time, Number, String) and combine them using logical AND or OR operators. This node is useful in workflows where you need to route, process, or analyze only those items that meet specific criteria.

Common scenarios:

  • Filtering out records that do not match certain quality standards.
  • Routing items to different branches based on their content.
  • Pre-processing data before sending it to another system.

Practical examples:

  • Only keep contacts whose "Status" is "Active" and "Last Login" was after a certain date.
  • Drop all orders with an amount less than $100.
  • Pass through only those support tickets whose subject contains the word "urgent".

Properties

Name Type Meaning
Conditions fixedCollection A collection of one or more conditions to evaluate. Each condition can be of type Boolean, Date & Time, Number, or String. Each type supports its own set of comparison operations.
Combine Conditions options Determines how multiple conditions are combined:
- AND: All conditions must be true for the item to pass.
- OR: At least one condition must be true for the item to pass.

Details for each Condition type:

  • Boolean: Compare two boolean values using "Equal" or "Not Equal".
  • Date & Time: Compare two dates/times using "Occurred After" or "Occurred Before".
  • Number: Compare two numbers using operations like "Smaller", "Larger", "Equal", "Is Empty", etc.
  • String: Compare two strings using operations like "Contains", "Starts With", "Regex Match", "Is Empty", etc.

Output

The node produces three outputs:

  1. Kept Items (Output 1):
    An array of items that matched the filter conditions (i.e., passed the filter).

  2. Dropped Items (Output 2):
    An array of items that did not match the filter conditions (i.e., failed the filter).

  3. Statistics (Output 3):
    A single JSON object summarizing the filtering result:

    {
      "dropAll": false,    // true if all items were dropped
      "keepAll": false,    // true if all items were kept
      "kept": 5,           // number of items kept
      "dropped": 3         // number of items dropped
    }
    

Note:

  • The node does not output binary data; all outputs are in JSON format.

Dependencies

  • No external services or API keys are required.
  • Relies on internal utility functions (e.g., for date conversion and comparison).
  • No special n8n configuration or environment variables needed.

Troubleshooting

Common issues:

  • Incorrect condition logic: If items are not being filtered as expected, double-check the selected operations and values for each condition.
  • Data type mismatches: Ensure that the values provided for each condition match the expected data type (e.g., don't compare a string to a number).
  • Empty input: If no items are passing through, verify that your conditions are not too restrictive.

Error messages:

  • No explicit error messages are thrown by this node under normal operation.
  • If a comparison fails due to invalid data (e.g., invalid date format), the item may not be filtered as intended. Check your input data formats.

Links and References

Discussion