flow context in subflows

908 views
Skip to first unread message

giang nam

unread,
May 21, 2016, 12:21:31 AM5/21/16
to Node-RED
Hi there,

Currently it seems subflows cannot access the main flow's context such as flow.get('some var') right?

Is this intended?

Thanks

Julian Knight

unread,
May 21, 2016, 12:10:25 PM5/21/16
to Node-RED
Context variables are local to a specific node instance.

However, you can use global variables and these are available everywhere including in subflows.

Nicholas O'Leary

unread,
May 21, 2016, 12:20:34 PM5/21/16
to Node-RED

Whilst what you say is correct Julian, the question is about the Flow context.

The flow context a node in a subflow has access to is the subflow's flow context, not the flow context of the flow the subflow instance node is on. That is intentional.

Nick


--
http://nodered.org
 
Join us on Slack to continue the conversation: http://nodered.org/slack
---
You received this message because you are subscribed to the Google Groups "Node-RED" group.
To unsubscribe from this group and stop receiving emails from it, send an email to node-red+u...@googlegroups.com.
To post to this group, send email to node...@googlegroups.com.
Visit this group at https://groups.google.com/group/node-red.
For more options, visit https://groups.google.com/d/optout.

Julian Knight

unread,
May 21, 2016, 4:24:18 PM5/21/16
to Node-RED
Drat, forgot about the additional context. 

James Vodanovich

unread,
Jan 24, 2017, 6:42:34 AM1/24/17
to Node-RED

A bit late but you can use a function in front of the sub flow on the flows tab to inject a value(s) from the flow's context

msg.payload["my_flow_var"] = flow.get("my_flow_var")
return msg;
Reply all
Reply to author
Forward
0 new messages