IFAdvanced icon

IFAdvanced

Route items to different branches (true/false) and an additional statistics branch

Overview

The IFAdvanced node is a powerful conditional router for n8n workflows. It evaluates one or more user-defined conditions on incoming data items and routes each item to either a "true" branch, a "false" branch, or outputs summary statistics. This node supports complex logic by allowing multiple condition types (boolean, date & time, number, string) and combining them using "ALL" (all conditions must be met) or "ANY" (at least one condition must be met).

Common scenarios:

  • Filtering data based on multiple criteria (e.g., only pass orders over $100 placed after a certain date).
  • Branching workflow execution depending on the content of incoming items.
  • Creating advanced filters with combinations of string matching, numerical comparisons, and date checks.

Practical examples:

  • Route support tickets to different teams if the priority is "high" and the subject contains "urgent".
  • Split contacts into two groups: those who signed up in the last 30 days and those who did not.
  • Send notifications only if a sensor value exceeds a threshold and the status is "active".

Properties

Name Type Meaning
Conditions fixedCollection A set of rules to compare values. Each rule can be of type Boolean, Date & Time, Number, or String.
  Boolean   group Compares two boolean values using "Equal" or "Not Equal".
  Date & Time   group Compares two dates/times using "Occurred After" or "Occurred Before".
  Number   group Compares two numbers using operations like "Smaller", "Larger", "Equal", "Is Empty", etc.
  String   group Compares two strings using operations like "Contains", "Starts With", "Regex Match", "Is Empty", etc.
Combine options Determines how multiple conditions are combined: "ALL" (all must match) or "ANY" (at least one matches).

Details for each condition type:

  • Boolean

    • Value 1 (boolean): The first value to compare.
    • Operation (options): "Equal", "Not Equal".
    • Value 2 (boolean): The second value to compare.
  • Date & Time

    • Value 1 (dateTime): The first date/time value.
    • Operation (options): "Occurred After", "Occurred Before".
    • Value 2 (dateTime): The second date/time value.
  • Number

    • Value 1 (number): The first number.
    • Operation (options): "Smaller", "Smaller or Equal", "Equal", "Not Equal", "Larger", "Larger or Equal", "Is Empty", "Is Not Empty".
    • Value 2 (number): The second number (not required for "Is Empty"/"Is Not Empty").
  • String

    • Value 1 (string): The first string.
    • Operation (options): "Contains", "Not Contains", "Ends With", "Not Ends With", "Equal", "Not Equal", "Regex Match", "Regex Not Match", "Starts With", "Not Starts With", "Is Empty", "Is Not Empty".
    • Value 2 (string): The second string (not required for some operations).
    • Regex (string): The regex pattern (used when operation is "Regex Match" or "Regex Not Match").

Output

The node produces three outputs:

  1. True branch: Items that matched the condition(s) according to the combine setting.
  2. False branch: Items that did not match the condition(s).
  3. Statistics branch: A single item with a json object containing:
    {
      "allTrue": false,    // true if all input items matched the condition(s)
      "allFalse": false,   // true if none of the input items matched
      "trueCount": 0,      // number of items routed to the true branch
      "falseCount": 0      // number of items routed to the false branch
    }
    

Note: No binary output is produced.


Dependencies

  • moment: Used for date/time parsing and manipulation.
  • n8n-workflow: For error handling and workflow integration.

No external API keys or special environment variables are required.


Troubleshooting

Common issues:

  • Invalid DateTime values: If a date/time value cannot be parsed, the node will throw an error indicating the invalid value.
  • Incorrect data types: Supplying a string where a number is expected (or vice versa) may cause unexpected results or errors.
  • Regex errors: Invalid regular expression patterns may cause the node to fail.

Error messages:

  • "The value \"...\" is not a valid DateTime.": Ensure your date/time values are in a recognized format.
  • Other errors may occur if required fields are missing or if the wrong data type is provided.

How to resolve:

  • Double-check the data types and formats of your input values.
  • Use expressions to ensure correct formatting.
  • Test regex patterns before use.

Links and References

Discussion