# Trying to gather global vars into a single object once daily

**URL:** <https://discourse.nodered.org/t/trying-to-gather-global-vars-into-a-single-object-once-daily/51855>\
**Category:** General\
**Created:** [4 October 2021 18:56 UTC](https://discourse.nodered.org/t/trying-to-gather-global-vars-into-a-single-object-once-daily/51855 "2021-10-04T18:56:40Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![HeneryH](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/heneryh/32/48986_2.png) [@HeneryH](https://discourse.nodered.org/u/HeneryH)\
**Post date:** [4 October 2021 18:56 UTC](https://discourse.nodered.org/t/trying-to-gather-global-vars-into-a-single-object-once-daily/51855/1 "2021-10-04T18:56:40Z")

</div>

Hi folks. I have a flow that is monitoring a series of IoT things and sending SMS alerts just fine.

I am trying to do something that seems simple enough. Create a daily SMS that gathers designated saved global variables.

I thought that generating a single json object using the Change Node would be pretty straight forward but I just can't get the syntax right.

When I try something like

{  
"var1" : global.get(x),  
}

it chokes on the 'g'.

When I use  
{  
"var1": "global.get(x)" or global.x  
}

it literally prints the string "global.get..."

Any ideas on the best way to do this?

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [4 October 2021 19:04 UTC](https://discourse.nodered.org/t/trying-to-gather-global-vars-into-a-single-object-once-daily/51855/2 "2021-10-04T19:04:13Z")

</div>

`"var1": $globalContext("x"),`  
Should be corrext. Select JSONata in the dropdown .

---

<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:** [18 October 2021 19:04 UTC](https://discourse.nodered.org/t/trying-to-gather-global-vars-into-a-single-object-once-daily/51855/3 "2021-10-18T19:04:50Z")

</div>

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