# $env() variables in normal flows - checking

**URL:** https://discourse.nodered.org/t/env-variables-in-normal-flows-checking/76793
**Category:** General
**Created:** [21 March 2023 23:36 UTC](https://discourse.nodered.org/t/env-variables-in-normal-flows-checking/76793 "2023-03-21T23:36:37Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [21 March 2023 23:36 UTC](https://discourse.nodered.org/t/env-variables-in-normal-flows-checking/76793/1 "2023-03-21T23:36:37Z")

</div>

(I'm a gluten for punishment.)

I've decided to make more subflows.  
But while making them it is sometimes better to have them _in the real world_ so I can watch what is going on in/with them.

`env$()` that would be ..... equivalent to `global` or `flow` context?  
I'm guessing `flow` but want to check before the hole gets too big. 😉

---

<div class="post-metadata">

### Author: ![ralphwetzel](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ralphwetzel/32/53713_2.png) [@ralphwetzel](https://discourse.nodered.org/u/ralphwetzel)
#### Post date: [22 March 2023 07:03 UTC](https://discourse.nodered.org/t/env-variables-in-normal-flows-checking/76793/2 "2023-03-22T07:03:04Z")

</div>

> [@Trying\_to\_learn](#):
>
> I've decided to make more subflows.

While I have the impression, you _love_ subflows 😉 ... there's really no need (anymore) to use them that intensively.  
You may use the `link-call` nodes to do **almost** the same - but (from my perspective) easier to implement & to maintain. If you like to have these (called) flows being separated, just put them on a separate tab. The `link-call` node is able to call (`link-in` nodes on) other tabs as well.

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [22 March 2023 08:27 UTC](https://discourse.nodered.org/t/env-variables-in-normal-flows-checking/76793/3 "2023-03-22T08:27:02Z")

</div>

Subflows and I are only new acquaintances.

Originally I wrote EVERYTHING on the tab level.

But when I have things like:

 ![Screenshot from 2023-03-22 19-13-11](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/8/3867f250c8ccb586bfdac9f2fb2cbb5c74b149a0.png)

Each of those columns of indicator and .... 7 buttons. It was a LOT of code and if I changed one: I had to change them all.  
This became painful after a few months of trial and error in my early days.

Then I have things like these:  
(not all but they are used a lot)  
_Event lists_ - as I shall call them.\*

 ![Screenshot from 2023-03-18 09-55-20](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/d/fdc7db1fc53611433e8803d916ff013cbb89afb7.png)

 ![Screenshot from 2023-03-22 19-10-20](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/5/f54bfb4e71e3ede427fc59b45b7bbf5e982392c7.jpeg)

This one they are mostly collapsed. But you can see their similarity.

Those EVENT lists are somewhat big.

And if I change one: (you guessed it) they all need updating.

For the most that is not too hard, but some are subtly different and can cause grief if I forget that when _rolling out updates_.

I am NOT a programmer, but am learning how to better structure code. (Well, I hope I am)

I don't think the `link call` would work as there are a few _parameters_ sent to the EVENT list.  
Then thre are the controls.:  
Displaying / Logging / Clearing the list / _filtering_ and so on.

---

<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: [22 March 2023 09:30 UTC](https://discourse.nodered.org/t/env-variables-in-normal-flows-checking/76793/4 "2023-03-22T09:30:43Z")

</div>

> [@Trying\_to\_learn](#):
>
> I don't think the `link call` would work as there are a few _parameters_ sent to the EVENT list.

How do you send the parameters and events?

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [22 March 2023 09:33 UTC](https://discourse.nodered.org/t/env-variables-in-normal-flows-checking/76793/5 "2023-03-22T09:33:34Z")

</div>

Complicated message structures for _inputs_ for things like buttons, etc.

But for _fixed_ things like .... say: computer names..... I will use `env()` in the subflow's node settings.

But I want to check how I can test that at the flow level.  
Where do I set the `env()`?  
I know that is an obvious question, but I just want to be sure before I start spending too much time on it learning.

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [22 March 2023 09:42 UTC](https://discourse.nodered.org/t/env-variables-in-normal-flows-checking/76793/6 "2023-03-22T09:42:36Z")

</div>

> [@Trying\_to\_learn](#):
>
> But I want to check how I can test that at the flow level.  
> Where do I set the `env()`?

You can set environment variables on a flow via the flow's own edit dialog:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/1/71f1233cc71f6cf612fc57be1837c073ea144dcf.png)

---

<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: [22 March 2023 15:18 UTC](https://discourse.nodered.org/t/env-variables-in-normal-flows-checking/76793/7 "2023-03-22T15:18:25Z")

</div>

> [@Trying\_to\_learn](#):
>
> Complicated message structures for _inputs_ for things like buttons, etc.

Those would be exactly the same using a link call rather than a subflow. It is the configurable env vars you would lose, those would have to be passed in the message too.

---

<div class="post-metadata">

### Author: ![Trying\_to\_learn](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/trying_to_learn/32/28400_2.png) [@Trying\_to\_learn](https://discourse.nodered.org/u/Trying_to_learn)
#### Post date: [3 April 2023 21:54 UTC](https://discourse.nodered.org/t/env-variables-in-normal-flows-checking/76793/8 "2023-04-03T21:54:36Z")

</div>

Sorry Nick, but I am exploring things and have fallen into another _Rabbit hole_ with this.

After recent events and subflows, and `getenv()` I am referring back to this and things don't make sense.

I'm asking you only because ........ I am now at a loss to whom I can ask and get a helpful reply.

If I am reading what you said (and can see) how to set `env$()` variables, I seem unable to test accessing the values.

At this stage, I am using the `change` node to test recent things told to me.  
But the whole thing seems _wrong_.

When I move to the tab and am about to double click I see confusing information - but that's another thing. Sorry.  
I open the window as you show and set the environment variable.  
But I'm stuck how to access it.

I'll shut up here, as I fear I am now only typing words/characters and not really helping my situation.

---

<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: [17 April 2023 21:54 UTC](https://discourse.nodered.org/t/env-variables-in-normal-flows-checking/76793/9 "2023-04-17T21:54:50Z")

</div>

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