# Editing a switch node base value from the dashboard

**URL:** <https://discourse.nodered.org/t/editing-a-switch-node-base-value-from-the-dashboard/29709>\
**Category:** Dashboard\
**Created:** [8 July 2020 10:20 UTC](https://discourse.nodered.org/t/editing-a-switch-node-base-value-from-the-dashboard/29709 "2020-07-08T10:20:33Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![zsoni96](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zsoni96/32/26854_2.png) [@zsoni96](https://discourse.nodered.org/u/zsoni96)\
**Post date:** [8 July 2020 10:20 UTC](https://discourse.nodered.org/t/editing-a-switch-node-base-value-from-the-dashboard/29709/1 "2020-07-08T10:20:34Z")

</div>

Hello everyone,

I have a question : Can you somehow edit the base value of a switch node in dashboard?

 ![node](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/4/c4c6f16fc9ce5460165b62606ec33fed76a49695.png)

In my case the switch node sends a payload when the value is bigger than 3000 but can i somehow edit that value from the dashboard instead of opening it from the node itself?? eg.: instead of 3000 to be 200?

---

<div class="post-metadata">

**Author:** ![ghayne](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ghayne/32/39_2.png) [@ghayne](https://discourse.nodered.org/u/ghayne)\
**Post date:** [8 July 2020 10:27 UTC](https://discourse.nodered.org/t/editing-a-switch-node-base-value-from-the-dashboard/29709/2 "2020-07-08T10:27:42Z")

</div>

Instead of a fixed value in the switch node use a global variable.

---

<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:** [8 July 2020 10:42 UTC](https://discourse.nodered.org/t/editing-a-switch-node-base-value-from-the-dashboard/29709/3 "2020-07-08T10:42:03Z")

</div>

Also if the value to be compared against is in the message then you can compare against `msg.some_attribute`

---

<div class="post-metadata">

**Author:** ![zsoni96](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zsoni96/32/26854_2.png) [@zsoni96](https://discourse.nodered.org/u/zsoni96)\
**Post date:** [8 July 2020 11:02 UTC](https://discourse.nodered.org/t/editing-a-switch-node-base-value-from-the-dashboard/29709/4 "2020-07-08T11:02:47Z")

</div>

Can you please send me an example flow? I have no idea how to do it.  
I would really appreciate it

---

<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:** [8 July 2020 12:40 UTC](https://discourse.nodered.org/t/editing-a-switch-node-base-value-from-the-dashboard/29709/5 "2020-07-08T12:40:47Z")

</div>

> [@zsoni96](#):
>
> I have no idea how to do it.

Have a careful read of the node red docs page Working with Messages, then tell us what in particular you don't know how to do, if you still don't.

---

<div class="post-metadata">

**Author:** ![zsoni96](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zsoni96/32/26854_2.png) [@zsoni96](https://discourse.nodered.org/u/zsoni96)\
**Post date:** [8 July 2020 13:00 UTC](https://discourse.nodered.org/t/editing-a-switch-node-base-value-from-the-dashboard/29709/6 "2020-07-08T13:00:36Z")

</div>

So i set up a switch to compare it to msg.topic (base value of it comes from an inject and the value is 10)  
And then i pass a number there as an msg.payload which is bigger and one which is smaller than 10 but nothing happens

```auto
[{"id":"2cf862d7.502fee","type":"tab","label":"Flow 1","disabled":false,"info":""},{"id":"77567440.2acd0c","type":"debug","z":"2cf862d7.502fee","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":910,"y":340,"wires":[]},{"id":"7746ae89.6899d","type":"inject","z":"2cf862d7.502fee","name":"","topic":"","payload":"10","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":110,"y":340,"wires":[["aa8de96b.435838"]]},{"id":"23600647.be59ba","type":"switch","z":"2cf862d7.502fee","name":"","property":"paylaod","propertyType":"msg","rules":[{"t":"gt","v":"topic","vt":"msg"}],"checkall":"true","repair":false,"outputs":1,"x":690,"y":260,"wires":[["77567440.2acd0c"]]},{"id":"cde726a8.aed498","type":"inject","z":"2cf862d7.502fee","name":"","topic":"","payload":"2000","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":140,"wires":[["23600647.be59ba"]]},{"id":"d21c3318.3c516","type":"inject","z":"2cf862d7.502fee","name":"","topic":"","payload":"3","payloadType":"num","repeat":"","crontab":"","once":false,"onceDelay":0.1,"x":150,"y":180,"wires":[["23600647.be59ba"]]},{"id":"aa8de96b.435838","type":"change","z":"2cf862d7.502fee","name":"","rules":[{"t":"move","p":"payload","pt":"msg","to":"topic","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":350,"y":300,"wires":[["23600647.be59ba","77567440.2acd0c"]]}]

```

---

<div class="post-metadata">

**Author:** ![zsoni96](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zsoni96/32/26854_2.png) [@zsoni96](https://discourse.nodered.org/u/zsoni96)\
**Post date:** [8 July 2020 13:25 UTC](https://discourse.nodered.org/t/editing-a-switch-node-base-value-from-the-dashboard/29709/7 "2020-07-08T13:25:47Z")

</div>

Same happens if i use a global varaible

```auto
[{"id":"79ee503e.0c074","type":"function","z":"2cf862d7.502fee","name":"","func":"var a= global.get(\"temp\");\nmsg.payload= a;\nreturn msg;","outputs":1,"noerr":0,"x":790,"y":540,"wires":[[]]}]

```

---

<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:** [8 July 2020 14:16 UTC](https://discourse.nodered.org/t/editing-a-switch-node-base-value-from-the-dashboard/29709/8 "2020-07-08T14:16:41Z")

</div>

Try this (note, as well as trying to use values from multiple messages at once you had misspelt payload in the switch node

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

```auto
[{"id":"42cb070e.d85ea8","type":"debug","z":"57017347.8029cc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","x":670,"y":280,"wires":[]},{"id":"c91cf0f9.979468","type":"inject","z":"57017347.8029cc","name":"p: 10, t:3","props":[{"p":"payload"},{"p":"topic","v":"3","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"10","payloadType":"num","x":240,"y":280,"wires":[["6e4a835a.9b3c04"]]},{"id":"6e4a835a.9b3c04","type":"switch","z":"57017347.8029cc","name":"","property":"payload","propertyType":"msg","rules":[{"t":"gt","v":"topic","vt":"msg"}],"checkall":"true","repair":false,"outputs":1,"x":470,"y":280,"wires":[["42cb070e.d85ea8"]]},{"id":"b1c8961e.31701","type":"inject","z":"57017347.8029cc","name":"p: 10, t:2000","props":[{"p":"payload"},{"p":"topic","v":"2000","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"10","payloadType":"num","x":230,"y":340,"wires":[["6e4a835a.9b3c04"]]}]

```

---

<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:** [7 August 2020 14:16 UTC](https://discourse.nodered.org/t/editing-a-switch-node-base-value-from-the-dashboard/29709/9 "2020-08-07T14:16:44Z")

</div>

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