Hi, im begginer on this world of the node-red.
Im trying to pass the value of a type flow variable. This to be worked on in a subflow.
How cand send variable to subflow?
Hi, im begginer on this world of the node-red.
Im trying to pass the value of a type flow variable. This to be worked on in a subflow.
How cand send variable to subflow?
In the subflow you can access the flow variables of the parent flow like:
flow.get("$parent.myVariable")
and for variables use:
$env("VarMax")
Hi, bakman your repley its work. Now I have some questions:
In node inject how can do this? -> flow.$parent.$env("counter")
The much better (and portable/reusable/pure) way to do this is to add variables to the msg
then you simply pick them up in the subflow.
Main flow...
inject (msg.payload
← flow.contador0
) → Subflow → debug
Subflow...
Input → function (use msg.payload
) → output
Accessing parent flow variables is basically for async problems, reduced portability of code etc etc.
Thanks for your replay!
but i do dont understand what you are trying to explain.
Please you can add code example
If you are new to node-red and its concepts I would recommend to avoid subflows for now. Also note that you cannot use inject nodes inside a subflow.
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.