# "change node" Variables in key

**URL:** <https://discourse.nodered.org/t/change-node-variables-in-key/4248>\
**Category:** General\
**Created:** [24 October 2018 09:08 UTC](https://discourse.nodered.org/t/change-node-variables-in-key/4248 "2018-10-24T09:08:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Little](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/little/32/2611_2.png) [@Little](https://discourse.nodered.org/u/Little)\
**Post date:** [24 October 2018 09:08 UTC](https://discourse.nodered.org/t/change-node-variables-in-key/4248/1 "2018-10-24T09:08:06Z")

</div>

Hello  
It is possible to use templates in keys?  
I need to dynamically add/remove values and I need to parse these values from incoming msg.payload.  
I know how to do this with "function node" but i want to do this in "change node"

![img_1](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/3/3c4cc9e6e897cd706790441e64d2d06d133a39b7.png)

I need this:

![img_2](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/2X/a/af8a16c14d6ee62d3407a6e8dec95301f6405b44.png)

---

<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:** [24 October 2018 09:14 UTC](https://discourse.nodered.org/t/change-node-variables-in-key/4248/2 "2018-10-24T09:14:52Z")

</div>

Hi @Little - no, it isn't possible to do that.

If you were getting a value from context, then you could use a JSONata expression, as I described in this topic - [How to use msg.payload as an index in a change node?](https://discourse.nodered.org/t/how-to-use-msg-payload-as-an-index-in-a-change-node/4215)

But you want to set a value in context... there's no convenient way of doing that in a Change node today. You'd have to use a Function node:

```auto
flow.set("store.mode_"+msg.payload.index,msg.enabled);
return msg;

```

---

<div class="post-metadata">

**Author:** ![Little](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/little/32/2611_2.png) [@Little](https://discourse.nodered.org/u/Little)\
**Post date:** [24 October 2018 09:20 UTC](https://discourse.nodered.org/t/change-node-variables-in-key/4248/3 "2018-10-24T09:20:41Z")

</div>

Thanks. I will continue to use "function node"
