# How to refresh global variable

**URL:** https://discourse.nodered.org/t/how-to-refresh-global-variable/69820
**Category:** General
**Created:** [31 October 2022 09:50 UTC](https://discourse.nodered.org/t/how-to-refresh-global-variable/69820 "2022-10-31T09:50:14Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![rush\_cs](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rush_cs/32/69509_2.png) [@rush\_cs](https://discourse.nodered.org/u/rush_cs)
#### Post date: [31 October 2022 09:50 UTC](https://discourse.nodered.org/t/how-to-refresh-global-variable/69820/1 "2022-10-31T09:50:14Z")

</div>

I am currently using global variables to display data from different function. The data does not display real time changes. if I stop the flow, the value of the output changes. How can I make it so the values being displayed are updated real-time?

---

<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: [31 October 2022 10:01 UTC](https://discourse.nodered.org/t/how-to-refresh-global-variable/69820/2 "2022-10-31T10:01:25Z")

</div>

global variables are not reactive (by design)

there is a hack I posted (some time ago) to make them reactive but this no longer _really_ flow programming (you lose sight of what is changing and all the wonderful things node-red is about)

Instead, if you share a minimal flow example with some background of what you are doing & why - we can probably show you an event driven alternative way of achieving your goal.

---

<div class="post-metadata">

### Author: ![rush\_cs](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rush_cs/32/69509_2.png) [@rush\_cs](https://discourse.nodered.org/u/rush_cs)
#### Post date: [31 October 2022 10:27 UTC](https://discourse.nodered.org/t/how-to-refresh-global-variable/69820/3 "2022-10-31T10:27:22Z")

</div>

I am currently making a simulator for pumps. The pressure\_sim needs the current value of current and voltage.

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

---

<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: [31 October 2022 10:36 UTC](https://discourse.nodered.org/t/how-to-refresh-global-variable/69820/4 "2022-10-31T10:36:40Z")

</div>

Since I cannot see code and field values inside of a picture - I can only speculate.

Here is my initial guess...

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

---

<div class="post-metadata">

### Author: ![rush\_cs](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rush_cs/32/69509_2.png) [@rush\_cs](https://discourse.nodered.org/u/rush_cs)
#### Post date: [31 October 2022 10:49 UTC](https://discourse.nodered.org/t/how-to-refresh-global-variable/69820/5 "2022-10-31T10:49:03Z")

</div>

Thank you, it works now!

---

<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 November 2022 10:49 UTC](https://discourse.nodered.org/t/how-to-refresh-global-variable/69820/6 "2022-11-14T10:49:11Z")

</div>

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