I have configured a switch node in a workflow with regex. If a value is met twice or three times, it should go all the necessary paths.
Unfortunately in my example it is runnig only to path0 for the example value of “Tarif” = “BP700”.
For this example value it should go through outputKey0 and outputKey1. How can I achieve that?
It seems like the switch node acts as if you would add a break; statement after each case in js, and thus only ever returns an output at the first match of your regex. You can see the same behavior with this simple test setup:
Instead of the IF node you could also consider using Filter nodes. They are almost identical to the IF node but have only one output, so will keep the workflow just a little bit cleaner.
The issue lies in its “break” logic, which restricts the ability to match multiple criteria simultaneously. For instance, consider an input scenario where the string includes various roles such as “administrator, developer, maintainer”. Ideally, I want the system to recognize and assign each of these roles appropriately. However, due to the existing logic, it processes only the first matching criterion and disregards the rest.
The item is role: "administrator, developer, maintainer",
the 3 rules in the Switch node are checking for the 3 strings: administrator, developer, and maintainer.
If Send data to all matching outputs is ON, the item is sent to all 3 outputs.
is this what you need?