Flow Context variables and passing them to a subflow

I have some very repetitive single function nodes that come up on around 20 or so maybe more, maybe less flows... I want to move them all to a subflow to allow for easier editing in future as the system expands, should it be required.

Essentially, for the function, there is one input, one global variable and one flow variable that gets used by the function node to do its work. Moving the function node to a subflow leaves me with the problem of reading the flow variable of the parent flow... The global variable is not a problem, neither is the input... (Unfortunately the flow variable cannot be moved to a global variable)

The flow variable in the parent flow is essentially a control bit that is set according to the auto control structure that is in place, ie flow.control = 1 or 0, the function node as it currently stands then processes this bit and provides an output (On or Off) depending on what the global variable permits, and what the input to the function allows...

It appears that the parent flow variables are isolated from the subflow flow variables... Is there any suggestion as to how to "draw" this one parent flow variable value into the subflow?

TIA
Ed

1 Like

This may help you

Well Spotted Sire!!

I bumbled right past that one...as usual!!

One minor code change in the subflow function was needed:
var Control = flow.get("$parent.Control")
//var Control=flow.get('Control');

Seems like its working now!!

Thanks Heaps!!

Ed

No problem. Glad I helped.

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