Coming from traditional programming, I am creating subflows to allow 'reusability' .
In main flow, I need to run 3 'instances' (is it the right term in node-red?) of a subflow
each subflow handle a msg,payload with an array of data
i am able to parse all data, aggregate and emit as a modified payload from the subflow
To do this, I am activley using flow.* context variables to save data between manipulations
The problem I noticied is that the flow.* variables are shared between all instances of same subflow, so using 1 instance works. using 3 instances causes that my data is messed up, mixed, between data coming from different instances in different time slice.
I was thinking that flow.* variables was 'local'. Instead they are something like statics vars, shared between all instances.
To be more clear, and sorry because English is not my native language,
first instance of a flow set flow.temp = 1
second instance of a flow set flow.temp =2
I need, or I would like, to preserve flow.temp isolated between two instances.
Since node context applies only to the node that created it, it doesn't make sense in a change node. If you were able to create a node connect in a change node, that very change node would be the only node able to access that data. No other node in your flow could access it.
You could use a function node to store and retrieve the data.