[Feature Request]Duplicate existing switch statements

I'm doing a lot of Alexa phrase parsing nowadays and therefore using "contains" a lot.

It's very repetitive to having to keep going thru the sequence off adding new rule,selecting contains and retyping a complete string

As lots of times - the new string is similar to an existing one

It would be a much nicer to be able to just duplicate an existing action


I would argue against duplicating the value text but the evaluation type and output data type would be convenient. At least I've found that in most cases they will be the same on all cases.

I'd take any scraps that I can :slight_smile:

But since I'm basically saying - lets have a copy as well as existing cut/paste insert that we currently have then, its going to more consistent to copy/paste insert a whole line I think

Plus it gives me what I want so less typing/copy/pasting for me :slight_smile:

I now just realised I was talking about output data type while meaning the value in the evaluation field. Anyhow I would say the content in the evaluation field is what typically changes so it wouldn't make sense copying that. In your scenario you'd have the text on clipboard ready to paste on the next input field.

The "laborious" part is mousing through the two drop down menus IMO. :slightly_smiling_face:

I had a recent issue similar to yours. I have a change node with 76 rules and by the time I got to 40 rules, it was becoming very tedious to do all that scrolling.

Plus, I discovered that my rule sequence was important because when a rule is satisfied, the node continues scanning the rest of the rules. (I thought the node would exit when a rule is satisfied). For example, I am entering the node with a (string)number and when found, change msg.payload to an information string to be displayed in a Text node on the dashboard. I originally sorted the rules from shortest to longest. I.E. 123 would come before 12345. The node changed 123 to the text string, but it continued scanning the node rules and changed the 123 in 12345 as well. I fixed this by putting the longest rules first.

But with 50+ nodes to move about, this became tedious quite quickly.
My solution, and a workaround for your issue was to export the change node to a text file, then run the JSON data through JSON Formatter tool to make it human readable. I then edited my rules in the text editor. When done, I imported the node back into Node Red.

Hope this helps.

PS - in your settings file you can set flowFilePretty: true, to format the json for you.

There is an option at the bottom of the edit dialog to either 'check all rules' (the default behaviour), or 'stopping after first match'.

1 Like


1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.