# Newbie questions

**URL:** <https://discourse.nodered.org/t/newbie-questions/8040>\
**Category:** General\
**Created:** [16 February 2019 10:04 UTC](https://discourse.nodered.org/t/newbie-questions/8040 "2019-02-16T10:04:59Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![olbas](https://avatars.discourse-cdn.com/v4/letter/o/a88e4f/32.png) [@olbas](https://discourse.nodered.org/u/olbas)\
**Post date:** [16 February 2019 10:04 UTC](https://discourse.nodered.org/t/newbie-questions/8040/1 "2019-02-16T10:04:59Z")

</div>

I'm struggling with two very basic concepts.

1. I need to understand looping. I can see how to do this within a function node, but I want to repeat a set of nodes (slightly changing the parameters). If I used an Inject node set to repeat every second, how can I tell it to stop, after x times, or when a condition is matched?

2. I am aiming to have an app running from (probably) a windows scheduled batch file. After developing in Node-red, can I somehow package it up, so it can run independently? I have read that you can start node-red with a named flow, but I'm not sure how to export/save a flow, so that this can be specifically run. It seems like every flow in my node-red system that has an inject node set to automatic starts running, even though only one is named.

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [16 February 2019 10:30 UTC](https://discourse.nodered.org/t/newbie-questions/8040/2 "2019-02-16T10:30:00Z")

</div>

You can’t stop an inject node, but you could have a counter in a function node that stops sending a message forward after a certain number of times.

You can’t package flows to run independently.

“It seems like every flow in my node-red system that has an inject node set to automatic starts running, even though only one is named.”  
You need to explain this in more detail

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [16 February 2019 10:45 UTC](https://discourse.nodered.org/t/newbie-questions/8040/3 "2019-02-16T10:45:48Z")

</div>

> [@olbas](#):
>
> I have read that you can start node-red with a named flow

That means that you can specify a flow _file_ when when you start node-red, not an individual flow tab in a file. Unfortunately the word 'flow' is rather overloaded in node-red.

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [16 February 2019 10:50 UTC](https://discourse.nodered.org/t/newbie-questions/8040/4 "2019-02-16T10:50:45Z")

</div>

Also worth checking on [flows.nodered.org](http://flows.nodered.org) for flows you can import

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [16 February 2019 10:57 UTC](https://discourse.nodered.org/t/newbie-questions/8040/5 "2019-02-16T10:57:05Z")

</div>

> [@olbas](#):
>
> I need to understand looping.

There are many ways to manage looping. If you gave a bit more information about your application it may help to narrow those down.

---

<div class="post-metadata">

**Author:** ![olbas](https://avatars.discourse-cdn.com/v4/letter/o/a88e4f/32.png) [@olbas](https://discourse.nodered.org/u/olbas)\
**Post date:** [16 February 2019 11:18 UTC](https://discourse.nodered.org/t/newbie-questions/8040/6 "2019-02-16T11:18:39Z")

</div>

ukmoose many thanks for your reply.

To test how it works, I have two flows named 'RM' and 'fake' They each have an inject node set to automatic after 1 sec and 2 secs, and each link to a file output that appends to the same file with a simple message saying which flow 'This is RM' or 'This is 'Fake'.

When I click DEPLOY, Both flows append to the file without any further user action.

I'd now like to run it from the command line, so that only RM fires.

I tried 'node-red RM' as a named flow (and node-red RM.json) but this seems to want to create a new flow.

My reasons for this are that in my node-red system I will have lots of flows, but would like to isolate just one for running from the command line.

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [16 February 2019 11:22 UTC](https://discourse.nodered.org/t/newbie-questions/8040/7 "2019-02-16T11:22:45Z")

</div>

You can disable flows on a tab by clicking the tab and changing the status from enable to disabled.

But you can't choose a subset of flows to run from the command line.

---

<div class="post-metadata">

**Author:** ![olbas](https://avatars.discourse-cdn.com/v4/letter/o/a88e4f/32.png) [@olbas](https://discourse.nodered.org/u/olbas)\
**Post date:** [16 February 2019 11:24 UTC](https://discourse.nodered.org/t/newbie-questions/8040/8 "2019-02-16T11:24:43Z")

</div>

Thanks for explaining that Colin, it makes perfect sense. I envisage having a very messy node-red environment (the default flow file with lots of tabs with half written code) but would like to maintain a very pure 'production' flow file for the successful flow. I assume the way to do this is to start node red with two separately named flow files.

---

<div class="post-metadata">

**Author:** ![olbas](https://avatars.discourse-cdn.com/v4/letter/o/a88e4f/32.png) [@olbas](https://discourse.nodered.org/u/olbas)\
**Post date:** [16 February 2019 11:25 UTC](https://discourse.nodered.org/t/newbie-questions/8040/9 "2019-02-16T11:25:43Z")

</div>

That's really helpful. I promise to get better at this!

---

<div class="post-metadata">

**Author:** ![drmibell](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/drmibell/32/8424_2.png) [@drmibell](https://discourse.nodered.org/u/drmibell)\
**Post date:** [17 February 2019 18:28 UTC](https://discourse.nodered.org/t/newbie-questions/8040/10 "2019-02-17T18:28:10Z")

</div>

> [@olbas](#):
>
> I assume the way to do this is to start node red with two separately named flow files.

You might also look at the Projects feature. I think it could do what you want without having to re-start Node-RED.
