# Setting inject node interval from env variable (in subflow)

**URL:** https://discourse.nodered.org/t/setting-inject-node-interval-from-env-variable-in-subflow/38936
**Category:** General
**Created:** [11 January 2021 02:59 UTC](https://discourse.nodered.org/t/setting-inject-node-interval-from-env-variable-in-subflow/38936 "2021-01-11T02:59:38Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![dathor](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@dathor](https://discourse.nodered.org/u/dathor)
#### Post date: [11 January 2021 02:59 UTC](https://discourse.nodered.org/t/setting-inject-node-interval-from-env-variable-in-subflow/38936/1 "2021-01-11T02:59:38Z")

</div>

Hello

Strange one. I had been using a trigger for some checking logic off a inject node used in a subflow. I had been configuring the interval of this inject node via an environment variable. All works well when using seconds. If i change interval to minutes i get an error and cannot deploy??

syntax for interval: ${env-var}

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/4/6/46d5883e75caaf7bf55623e2770f684df065ab89.png)

Regards  
D

---

<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: [11 January 2021 09:48 UTC](https://discourse.nodered.org/t/setting-inject-node-interval-from-env-variable-in-subflow/38936/2 "2021-01-11T09:48:59Z")

</div>

Can you post a mini flow showing this to make it easier for us to test please.

---

<div class="post-metadata">

### Author: ![dathor](https://avatars.discourse-cdn.com/v4/letter/d/ad7895/32.png) [@dathor](https://discourse.nodered.org/u/dathor)
#### Post date: [11 January 2021 21:37 UTC](https://discourse.nodered.org/t/setting-inject-node-interval-from-env-variable-in-subflow/38936/3 "2021-01-11T21:37:15Z")

</div>

of course...

```auto
[{"id":"f11caa36.6bdd08","type":"subflow","name":"Subflow 1","info":"","category":"","in":[],"out":[{"x":700,"y":210,"wires":[{"id":"e7da42f1.95859","port":0},{"id":"390962d8.89312e","port":0}]}],"env":[{"name":"test","type":"num","value":"6"}],"color":"#DDAA99"},{"id":"e7da42f1.95859","type":"inject","z":"f11caa36.6bdd08","name":"seconds","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"${test}","crontab":"","once":false,"onceDelay":0.1,"topic":"seconds","payload":"","payloadType":"date","x":340,"y":210,"wires":[[]]},{"id":"390962d8.89312e","type":"inject","z":"f11caa36.6bdd08","name":"minutes","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"NaN","crontab":"","once":false,"onceDelay":0.1,"topic":"minutes","payload":"","payloadType":"date","x":340,"y":290,"wires":[[]]},{"id":"89634b56.6586e8","type":"subflow:f11caa36.6bdd08","z":"eaaa5e2f.e4d8c","name":"","x":440,"y":240,"wires":[["ca5db143.5ae89"]]},{"id":"ca5db143.5ae89","type":"debug","z":"eaaa5e2f.e4d8c","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":600,"y":250,"wires":[]}]

```

---

<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: [11 January 2021 21:51 UTC](https://discourse.nodered.org/t/setting-inject-node-interval-from-env-variable-in-subflow/38936/4 "2021-01-11T21:51:24Z")

</div>

Yes, I see what you mean, it won't even let the inject node be configured with a variable and minutes.  
In fact it is nothing to do with subflows, it won't let you configure an inject like this in the main flow either

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/a/2/a234fc19736109d2a54f845c295d8d3a07b53a67.png)

It is ok if you specify seconds instead of minutes.

---

<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: [13 January 2021 09:57 UTC](https://discourse.nodered.org/t/setting-inject-node-interval-from-env-variable-in-subflow/38936/5 "2021-01-13T09:57:02Z")

</div>

I suggest submitting a bug report for this so it will get looked at at some point. [Issues · node-red/node-red · GitHub](https://github.com/node-red/node-red/issues)

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [13 January 2021 10:23 UTC](https://discourse.nodered.org/t/setting-inject-node-interval-from-env-variable-in-subflow/38936/6 "2021-01-13T10:23:37Z")

</div>

It's not a bug. Not all fields can accept environment variables. Any that are simple text can - but any that are calculated for display cannot be. The other typical one is the rules for change or switch nodes etc. In this case there is only one variable (the number in seconds). When it comes to display if it's a whole number of minutes we change it to minutes and likewise hours... - so if you put in 60 secs - save it - then re-edit - it will display as one minute. So no it's not a bug - just use seconds.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [14 March 2021 10:23 UTC](https://discourse.nodered.org/t/setting-inject-node-interval-from-env-variable-in-subflow/38936/7 "2021-03-14T10:23:37Z")

</div>

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