Add more outputs to Switch Node [GOT CREATED]

cool will have a play

1 Like

For anyone after more outputs for the switch node… Have you already tried the filter node? You can have as many of those as you want and it will only pass on the data that matches the filter. A bit like the If node but without the False branch, So far I have found that this provides everything I would want from a multi output switch node.

1 Like

@Jon right now the switch node has 3 outputs but the filte rnode has one output called “kept”

if I was using switch node for 3 outputs, I would connect the “0” branch to Set 1 of my nodes (to execute that branch), connect “1” branch to Set 2 of my nodes…

But how can we create branches with the Filter node?

Hey @pooria,

The Filter node doesn’t need branches, you would have one filter node for each option so from one node output you could go to 8 filter nodes.

That makes sense.

But it wouldn’t be the most elegant solution, right?

It’s like adding multiple switch nodes one after another for fallback to account for +4 switches but now isntead of having to duplicate switch nodes, you have to duplicate filter nodes.

Having a single switch node with multiple outputs would make sense. As for example if you have +4, 8, or 100 filter nodes then when you want to change something, you have to go through 100 filter nodes. But if all the rules are in one single switch node then you can just scroll down, change, and compare what each route is for

BUT thinking about it, if you were to use Filters it could allow for more ‘organization’ in the logic and POSSIBLY better “renaming” of each flow. Because the switch node currently outputs “0”,“1”, “2”…but with Filter node you could properly rename it to know what it is for.

BUT if we have a switch node with multiple outputs that you could rename each branch then that could work too

Also performance-wise, how would they differ?

  1. Single Switch node with 3 outputs (basically just processes the input ONCE)

  2. One input to 3 filters (has to send input to 3 filters to process it)

Would single switch be faster?

What if it’s 10, 20, or 100 output nodes?

@pooria Performance wise one node may be slightly better but… how likely would it be to have a switch node with 100 outputs anyway?

Have you already tried using the Filter node instead of a switch node? I am curious to find real world cases where it wouldn’t work as an option.

I’m currently using 8 filter nodes in a scenario i have to filter “message_type” which could be text, image, video, location, voice…

100 might be a bit of a stretch with “business” or “standard” api’s that have max like 10 or sth possible values for the keys. But with custom data (e.g. custom taxonomy), I see 100 can be totally possible.

For example, switching based on country names (if country = usa, =canada, …)

Hey @pooria,

Perfect so in your case is the Filter node working ok or are you seeing any issues with it at the moment?

I believe for most use cases the filter node solves the issue of needing more outputs on the Switch node.

None of this means we won’t add more outputs in the future but it would be nice to unblock users that may be waiting for this when they may not need it.

I might toy with the country idea though to see how that holds up, thanks for that.

1 Like

No worries.

You’re totally right that it unblocks users at the moment.

Though it has it’s limitations:

-The filter node works but that means the first node for each branch will be a filter node instead of the main node that it should be.

-As for example if you have +4, 8, or 100 filter nodes then when you want to change something, you have to go through 100 filter nodes. But if all the rules are in one single switch node then you can just scroll down, change, and compare what each route is for

-And also most importantly, the switch node has one value to check for (just value 1) BUT in Filter node you have to add two values to compare - if that makes sense Basically just more copy/pasting I

Hey everyone. I’m coming with good news to say that we will finally release a switch node with infinite outputs soon. We’re expecting to clean it up next week and then release it pretty soon :partying_face:

13 Likes

New version [email protected] got released which includes the GitHub PR 7499.

9 Likes

amazing!

well done team!

2 Likes

Love it, now I can deprecate the Switch9000 :slight_smile:

1 Like

I got up to 136 before I got bored of adding them :joy:

2 Likes

hahaha, 8 was enough for me to test :laughing:

Hi, two notes from my side:

  1. When specifying the fallback output, I must select one of the previously created routes, but not necessarily my fallback is one of them. Wouldn’t it be better to also have in the dropdown something like “Other” and then I can manually connect this fallback output in the editor with whatever I want?
    (in my example I had to create an extra route rule, that I called Fallback and then select it below in Fallback output)

  1. I find the chance of giving labels to each route great. However, the text gets abbreviated too short, it doesn’t visualize more than 5 characters… Can we have a bit more space for it?

SCR-20231115-omvr

Thanks!