(Re)starting a flow is easy but how does one stop/reset/initialize a flow?
By disconnecting the wire from a source node you can stop a flow.
What do you mean with "reset/initialize" ?
What is the issue you are facing ?
@bakman2, thanks for the reply.
And Deploy, of course.
I'm new to NR and just playing with many nodes to gain familiarity. To that end I have a function node that uses 2 node context variables, a count and a tally. I know I can just delete them after stopping the flow to reset them to "0" but I'm asking if there's a way to do that, and any initialization, without stopping the flow. It makes no real difference in my experimenting but my real world flows may have similar needs. I know I can use an inject node and a function to manipulate flow and global variables which is what my real flows will use but I'm trying to make sure I'm doing this the "easy" way thus the question.
In some of my real flows I use the schedex node for scheduled lighting and I use an inject node to send a message to the schedex nodes so they will emit the on/off per the schedule upon flow start. It feels a little kludgy to me but it works.
You don't have to stop the flow to delete the context, just delete it by using the context sidebar.
You could also do it by adding code in your function node, something like;
if (msg.payload == "reset") {
context.set("mydata1", 0);
context.set("mydata2", 0);
}
Then add an inject node that delivers the string value reset
.
There ya go! I like it. Thanks, @Paul-Reed
Actually that won't delete the context it will set it to 0. If you want to delete it you need to use context.set("mydata2");
Yes I realize that, but...
I assumed he meant 0 and not "0"
Indeed.
But
Is more good info so thanks to both of you.
Technically, to delete the context, I believe the command should be;
context.set("mydata2",undefined);
This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.