Enforcing Node order

Is there any node-red native or node plugin to enforce node order? For example, if I have 10 nodes in a flow and I want to make sure that node 8 doesn't go before node 7.

The reason I ask is that I have several custom nodes where the order they are place in the flow could negatively impact the end result. I am trying to make the placement of nodes as fool proof as possible. I have tried searching the documentation and for existing node plugins/functionality but haven't found anything yet. I imagine other people would want similar functionality. Of course I could create my own verification in each custom node but was hoping to avoid this if something already existed.

Thanks in advance.

That kind of goes against the general principles of flow-based programming. It is the flow that controls order. That said, there are contributed nodes that can help coordination so have a browse through the flows site.

Understood, Just in my case the order of the nodes does matter. I understand I am probably a one off because of the way I am using node-red and the person(s) creating the flow might not have in-depth knowledge of the custom nodes.

Anyway, thanks for the info and I will look through flows site.

Hi @mealbert - I'm afraid the editor doesn't have any means of enforcing that sort of constraint on nodes.

It has come up in the past, but not something we've put any thought into how it could be done.

If the order of operations is essential to outcome, would it perhaps make more sense to have all of your functionality contained within a single node and enforce that order internally rather than separating the operations?

1 Like

Thanks for the reply @knolleary. It would be a nice to have but I also realize that its probably not something a lot of people are requesting. Let me know if you ever do plan on implementing the feature as I have some ideas on how it could be implemented.


Hi @JayDickson,

Thanks for the reply. Unfortunately some of the operations could happen multiple times or not at all. Also there is some flexibility in the order of the operations but not complete flexibility so thats why one 1 node with all the operations will not work either. Thanks again.

Sounds like you need to implement a Finite State Machine -- there are several nodes that can help define the "states" you need, and the valid paths between them.

1 Like