I am struggling with a problem caused by my lack of knowledge of N8N. I would like to be able to create range conditions using a switch node. For example, if the value I receive from my webhook is between 5 and 10, execute Action 1; if it is between 11 and 13, execute Action 2, and so on.
How can I create these specific branches?
Information on your n8n setup
n8n version: 1.109.2
Database (default: SQLite): SQLite
n8n EXECUTIONS_PROCESS setting (default: own, main): main
Running n8n via (Docker, npm, n8n cloud, desktop app): running on premise
If you want to handle ranges with a Switch node, you can set it up like this:
Create a branch for values less than 5
Create another branch for values less than or equal to 10 (This way, any value between 5 - 10 will fall into this branch)
Add the next branch for values less than or equal to 13 (This way, any value between 11 - 13 will fall into this branch)
Continue adding conditions for each range you need.
By chaining your conditions in order, the Switch node will route the values into the correct range, and make sure the option “Send data to all matching outputs” is disabled