Add "Combine" functionality to Switch nodes (like for If nodes)

The idea is:

To add the Combine mode from the If node to the Switch node. It must tell how to apply Rules for the same Output.

Currently it is possible to check if a value is bigger (later) or smaller (earlier) then another value. There are no “AND”. “OR” operators to create more complex rules.

This functionality from the If node would help:
image

My use case:

Check if dates fall into a month or other interval. Check age, income intervals. Any kind of groupings.

I think it would be beneficial to add this because:

Right now the Switch node has no possibitly to combine Rules. This makes impossible to check if a value falls into in interal. Moreover, it makes senseless comparision Rules like “greater” or “less”. In the Workflow library there’s basically no Swich rules checking something else but equality.

For example, if we have the Date property, to separate data flows:

  • 0th output: Date from 1 to 31 of October '21,
  • 1st output: Date from 1 to 30 of November '21,
  • 2nd output: Date from 1 to 31 of December '21
  • 3rd output: the rest

This can be done using 3 “If” nodes and combining two conditions, for example:

  • Date is on or adter 1 of October '21
  • Date is on or adter 1 of October '21
  • Combine: ALL

But Switches are here to get rid of such consequent Ifs. So it would be cool to stay in a Switch solution here as well.

Any resources to support this?

It can be done in one of the ways:

  1. Include checkbox option “Combine rules for the same output”. If checked, n8n considers all the option for 0th output, for example, as all-combined: every Rule must be met to pass to the 0th output.

  2. Just copy the If “Combine” functionality, applying it to every output.

Are you willing to work on this?

Check the new functionality in case of developement