# Transfer a change from one node to all the same nodes

**URL:** https://discourse.nodered.org/t/transfer-a-change-from-one-node-to-all-the-same-nodes/30631
**Category:** General
**Created:** [23 July 2020 19:02 UTC](https://discourse.nodered.org/t/transfer-a-change-from-one-node-to-all-the-same-nodes/30631 "2020-07-23T19:02:18Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![volker1078](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/volker1078/32/19735_2.png) [@volker1078](https://discourse.nodered.org/u/volker1078)
#### Post date: [23 July 2020 19:02 UTC](https://discourse.nodered.org/t/transfer-a-change-from-one-node-to-all-the-same-nodes/30631/1 "2020-07-23T19:02:18Z")

</div>

I wanted to ask if it is possible to change several nodes at the same time. As an example, I have several switch or range nodes in my flow for which I would like to change the entered values. I change the value of one node and this value is transferred to all other nodes in the flow. Something like a global variable, is there something in Node-Red?

Greetings Volker

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [23 July 2020 19:06 UTC](https://discourse.nodered.org/t/transfer-a-change-from-one-node-to-all-the-same-nodes/30631/2 "2020-07-23T19:06:17Z")

</div>

> [@volker1078](#):
>
> Something like a global variable

like this?

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/f/5/f51a7be349fb543b8b2956a2209e44a614089f14.png)

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

---

<div class="post-metadata">

### Author: ![volker1078](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/volker1078/32/19735_2.png) [@volker1078](https://discourse.nodered.org/u/volker1078)
#### Post date: [23 July 2020 19:28 UTC](https://discourse.nodered.org/t/transfer-a-change-from-one-node-to-all-the-same-nodes/30631/3 "2020-07-23T19:28:54Z")

</div>

i don't understand it yet. can you give me more information?

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [23 July 2020 19:32 UTC](https://discourse.nodered.org/t/transfer-a-change-from-one-node-to-all-the-same-nodes/30631/4 "2020-07-23T19:32:22Z")

</div>

Sure.

You can store a value in a global variable (called context) and re-use it as many times as you like - just like you asked.

[Here is even more info](https://nodered.org/docs/user-guide/context)

---

<div class="post-metadata">

### Author: ![volker1078](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/volker1078/32/19735_2.png) [@volker1078](https://discourse.nodered.org/u/volker1078)
#### Post date: [9 August 2020 18:13 UTC](https://discourse.nodered.org/t/transfer-a-change-from-one-node-to-all-the-same-nodes/30631/5 "2020-08-09T18:13:50Z")

</div>

Hello,

Thank you for your answer. I finally found time to test this time and managed to do it with the change and function Node. Now I wanted to ask whether it is possible to define the range node as a global variable. In my flow, the message payload runs repeatedly through an A / D converter node and then through the change node. There are a total of 16 change nodes in the flow and it is tedious to change the values ​​for all of them one after the other.

So my question again is it possible to change the values ​​of a change node and these are transferred to all others?

Here is a screenshot of my change node

 ![InkedAnmerkung 2020-08-09 200329_LI](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/7/d/7d36b48d2a84c458d9784bc4b927715dbc65e702.jpeg)

Thank you for your efforts

Greetings Volker

---

<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: [9 August 2020 19:31 UTC](https://discourse.nodered.org/t/transfer-a-change-from-one-node-to-all-the-same-nodes/30631/6 "2020-08-09T19:31:36Z")

</div>

It is trivial to implement a Range node using a function node, in the function you could send it a message to change the range, or use flow/global context to define the range.

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [9 August 2020 20:02 UTC](https://discourse.nodered.org/t/transfer-a-change-from-one-node-to-all-the-same-nodes/30631/7 "2020-08-09T20:02:38Z")

</div>

you cant use flow or global variables for these but you can use environment variables

![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/b/2/b280caa05366620f84addb726d88e651696dafd8.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: [9 August 2020 20:35 UTC](https://discourse.nodered.org/t/transfer-a-change-from-one-node-to-all-the-same-nodes/30631/8 "2020-08-09T20:35:08Z")

</div>

So we understand better, why do you have to change the ranges routinely.

---

<div class="post-metadata">

### Author: ![volker1078](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/volker1078/32/19735_2.png) [@volker1078](https://discourse.nodered.org/u/volker1078)
#### Post date: [10 August 2020 18:41 UTC](https://discourse.nodered.org/t/transfer-a-change-from-one-node-to-all-the-same-nodes/30631/9 "2020-08-10T18:41:18Z")

</div>

do you have an example for this which explains exactly how it works? do you need an inject node for this?

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [10 August 2020 19:00 UTC](https://discourse.nodered.org/t/transfer-a-change-from-one-node-to-all-the-same-nodes/30631/10 "2020-08-10T19:00:49Z")

</div>

I don't understand.

Only you know how you want to use the scale node.

Your picture where you drew red circles around the boxes - I demonstrated that while you cannot use global variables, you can use environment variables.

Do you know what environment variables are and how to use them?

---

<div class="post-metadata">

### Author: ![volker1078](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/volker1078/32/19735_2.png) [@volker1078](https://discourse.nodered.org/u/volker1078)
#### Post date: [10 August 2020 20:26 UTC](https://discourse.nodered.org/t/transfer-a-change-from-one-node-to-all-the-same-nodes/30631/11 "2020-08-10T20:26:53Z")

</div>

no, unfortunately I don't know.

even from the node-red documentation, I do not judge really smart ...

[https://nodered.org/docs/user-guide/environment-variables](https://nodered.org/docs/user-guide/environment-variables)

how can I define the environment variables and retrieve them again?

---

<div class="post-metadata">

### Author: ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)
#### Post date: [10 August 2020 20:34 UTC](https://discourse.nodered.org/t/transfer-a-change-from-one-node-to-all-the-same-nodes/30631/12 "2020-08-10T20:34:48Z")

</div>

So environment variables are set in your operating system before you launch node red.

For example, on Windows you might have a batch file that launches node-red. You can set up some variables before you launch node-red (like constants) that you can pick up in node-red

E.g., your batch file might be something like...

```auto
set f1=0
set t1=4095
set f2=1
set t2=100
node-red

```

Then when node-red is running, you can pick up the value of these & use them in the range node (and other nodes)

If you use Linux, then it would be `export f1=0` etc.

---

<div class="post-metadata">

### Author: ![volker1078](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/volker1078/32/19735_2.png) [@volker1078](https://discourse.nodered.org/u/volker1078)
#### Post date: [12 August 2020 18:51 UTC](https://discourse.nodered.org/t/transfer-a-change-from-one-node-to-all-the-same-nodes/30631/13 "2020-08-12T18:51:19Z")

</div>

I got it done.  
with your advice and this page it worked.  
[https://flows.nodered.org/flow/8a13d11dfe80e279df83341e3e17bcc1](https://flows.nodered.org/flow/8a13d11dfe80e279df83341e3e17bcc1)

---

<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: [26 August 2020 18:51 UTC](https://discourse.nodered.org/t/transfer-a-change-from-one-node-to-all-the-same-nodes/30631/14 "2020-08-26T18:51:20Z")

</div>

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