# Help with \`change\` node and \`global\` values

**URL:** https://discourse.nodered.org/t/help-with-change-node-and-global-values/17192
**Category:** General
**Created:** [27 October 2019 12:31 UTC](https://discourse.nodered.org/t/help-with-change-node-and-global-values/17192 "2019-10-27T12:31:08Z")
**Posts on this page:** 5
**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: [27 October 2019 12:31 UTC](https://discourse.nodered.org/t/help-with-change-node-and-global-values/17192/1 "2019-10-27T12:31:09Z")

</div>

Folks, I'm stuck on how to parse/handle variables in the `change` node.

Scenario:  
global variable: `Shutdown_temperature` set to `75` (number)

I can easily get that value in the `change` node.

Set `msg.payload` to `global.Shutdown_temperature`.

Easy.

But what if I want _Shutdown\_temperature_ - 10?

Adding (or: appending) -10 to the text doesn't work.  
Or at time of posting it didn't seem to.

How would I do it without another node? Can it be done?

---

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [27 October 2019 12:37 UTC](https://discourse.nodered.org/t/help-with-change-node-and-global-values/17192/3 "2019-10-27T12:37:29Z")

</div>

Do you mean `global.Shutdown_temperature - 10` as variable name ? that is not a valid variable name.  
Or do you mean you want to calculate `global.Shutdown_temperature-10` ? JSONata can do that.

---

<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: [27 October 2019 12:41 UTC](https://discourse.nodered.org/t/help-with-change-node-and-global-values/17192/4 "2019-10-27T12:41:40Z")

</div>

(Yeah, ok my bad.)

I want to get the latter.

`global.Shutdown_temperature` - 10.

Could you please show me how?

---

<div class="post-metadata">

### Author: ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)
#### Post date: [27 October 2019 12:45 UTC](https://discourse.nodered.org/t/help-with-change-node-and-global-values/17192/5 "2019-10-27T12:45:48Z")

</div>

In the change node, set msg.payload to:  
JSONata:`$globalContext("Shutdown_temperature")-10`

This assumes that `Shutdown_temperature` is a number.

 ![29](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/e/eea9ee4b05dd0da5af3bcf2e0831beb4020db049.jpeg)

---

<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: [27 October 2019 12:57 UTC](https://discourse.nodered.org/t/help-with-change-node-and-global-values/17192/6 "2019-10-27T12:57:40Z")

</div>

Thanks.

Putting aside I (again) goofed with the name. Quickly and easily fixed.

For another reason, it doesn't seem to want to play the game.

This is the flow:

```auto
[{"id":"3e63b997.6fd786","type":"inject","z":"10dda891.0445cf","name":"","topic":"","payload":"","payloadType":"date","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":210,"y":1550,"wires":[["cb8cc631.9ff27"]]},{"id":"3b668264.063ba6","type":"debug","z":"10dda891.0445cf","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":640,"y":1550,"wires":[]},{"id":"cb8cc631.9ff27","type":"change","z":"10dda891.0445cf","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"$globalContext(\"shutdown_temperature\")-10","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":390,"y":1550,"wires":[["3b668264.063ba6"]]}]

```

This is the screen I see:

![Screenshot%20from%202019-10-27%2023-55-49](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/e/e66696c96476224d9cf634cd6ab4fbc4c69daf78.png)

Pressing the `inject` node..... Nothing comes out.

I'm an idiot!

I had the field set to {} instead of J: Too used to using the `{}` option.
