My journey into "Sub flows"

#1

After a lot of thought, I am starting my journey into sub-flows.

I get that it can only have one input and have multiple outputs.

So putting aside the "problem" with only 1 input as that is true with all other nodes, so really it just gets down to structuring this node as any other node.

So, I see there is an option to add comments for the node if you double click on the tab at the top of the screen.

To set the input/output(s) you click at the top of the screen and you get input and output nodes appear to connect to the flow.

Again: Ok.

I was thinking to do like other well built nodes and put a description on the output pins explaining their function.

Alas I don't think that is supported.

(Same for the input node I just realised.)

Just wanting to check before I submit a request for that.

Am I missing anything about the comments and how you can not set separate ones for input and output?

(Via edit)

Oh, I also see that you can't use node.status in the sub nodes and see what is going on.
That is a bit annoying.

Is this also something I am missing in how to implement?

0 Likes

#2

I put comment nodes inside the subflow against the input and outputs to describe what they are. That is much easier to see than comments inside the subflow config.

1 Like

#3

Did you see the post earlier today describing new subflow features available in the next version of node-red?

0 Likes

#4

Meanwhile - even in the existing version you can set input and output labels on the pins if you like

You can also use node.status - and use a status node outside to catch that status (it just doesn't show underneath like other nodes... - but as Colin says that is coming in 0.20)

0 Likes

#5

If you double-click on any of the Input or Output nodes inside a subflow it will open the Edit Properties dialog (the same one if you click the 'edit properties' button in the toolbar.

As with other nodes, you can go to the 'Appearance' tab and set labels for the inputs and outputs.

These are the labels that appear when you hover the mouse over the input/output ports of the node in the main workspace.

Local_Node-RED

You do not currently get to see these labels when editing the subflow itself - that isn't something I'd thought of but will look at adding as it makes sense to do so.

You can use node.status() in nodes within the subflow. The status event can be handled by a Status node however the status event will not appear against the subflow instance node - in otherwords, you won't get the text appearing below subflow instance node.

As @colin mentioned, we just released the next beta of 0.20 which adds some new subflow capabilities, including better handling of status.

0 Likes

#6

Colin: No I missed the update to the new version.

DCeeJay: thanks. I hardly ever look at that part of the node. Oops.

Nick: Sorry, I don't see This picture

But that could be because I am only using 0.19.5

Could you help me understand where this is?

Oh, and back to the node properties part.
That can't be set at the subflow creation level then?

As much as I can copy/paste the node with the data, pulling it out of the list of nodes, all the outputs are blanks.

0 Likes

#7

The picture i posted was from 0.19.5 that shows where to set the in and out labels. (Nicks was the equivalent from 0.20)

0 Likes

#8

DC,

Yeah, thanks.

I got the stuff you posted. As I explained: I seldom look at that part. Sorry. (My favourite word, it seems.)

While doing some testing, I got an error 401. Shall post when I get time.
It got parked when I got that and I am looking at some other logic I need to implement in different parts of the flow.

0 Likes

#9

@Trying_to_learn one quick word of caution before you delve too deep.

You cannot use dashboard nodes inside a subflow. Won't get into all the details of why, but just don't try it. It leads to unexpected layouts and you'll waste a lot of time trying to figure it out.

0 Likes

#10

Yeah, ok.

I don't have any dashboard nodes....

Just for "parity":

0 Likes