# Dashboard node does not pass on msg.topic that is a number

**URL:** https://discourse.nodered.org/t/dashboard-node-does-not-pass-on-msg-topic-that-is-a-number/70863
**Category:** General
**Tags:** node-red-dashboard
**Created:** [19 November 2022 01:42 UTC](https://discourse.nodered.org/t/dashboard-node-does-not-pass-on-msg-topic-that-is-a-number/70863 "2022-11-19T01:42:22Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![rxunique](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rxunique/32/70140_2.png) [@rxunique](https://discourse.nodered.org/u/rxunique)
#### Post date: [19 November 2022 01:42 UTC](https://discourse.nodered.org/t/dashboard-node-does-not-pass-on-msg-topic-that-is-a-number/70863/1 "2022-11-19T01:42:22Z")

</div>

I just noticed a strange behaviour, and wondering if this is indented or a bug

basically dashboard UI nodes does not pass on msg.topic that is a numeric value, only pass on string value. Very strange

I tested below with switch node and drop down node, haven't test all other ui node yet

```auto
[{"id":"d97966ec59d5c097","type":"inject","z":"ce844eb7236ba48b","name":"","props":[{"p":"payload"},{"p":"topic","v":"0","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":1140,"y":620,"wires":[["d53a0a4bbb1a9fe3","fb20f64378eb29b3"]]},{"id":"21915a546fa229d2","type":"debug","z":"ce844eb7236ba48b","name":"debug 6","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1500,"y":620,"wires":[]},{"id":"d53a0a4bbb1a9fe3","type":"debug","z":"ce844eb7236ba48b","name":"debug 7","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1340,"y":680,"wires":[]},{"id":"fb20f64378eb29b3","type":"ui_switch","z":"ce844eb7236ba48b","name":"","label":"switch","tooltip":"","group":"65cfe14d065c4d4c","order":24,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"topic","topicType":"msg","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","animate":false,"className":"","x":1330,"y":620,"wires":[["21915a546fa229d2"]]},{"id":"65cfe14d065c4d4c","type":"ui_group","name":"VMS Page1","tab":"1cf32eaaa813c254","order":1,"disp":true,"width":"9","collapse":false,"className":""},{"id":"1cf32eaaa813c254","type":"ui_tab","name":"VMS Form","icon":"dashboard","disabled":false,"hidden":false}]

```

---

<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: [19 November 2022 02:25 UTC](https://discourse.nodered.org/t/dashboard-node-does-not-pass-on-msg-topic-that-is-a-number/70863/2 "2022-11-19T02:25:27Z")

</div>

> [@rxunique](#):
>
> dashboard UI nodes does not pass on msg.topic that is a numeric value, only pass on string value

Does it pass a number less than or greater than zero?

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [19 November 2022 11:06 UTC](https://discourse.nodered.org/t/dashboard-node-does-not-pass-on-msg-topic-that-is-a-number/70863/3 "2022-11-19T11:06:57Z")

</div>

When you say "basically dashboard UI nodes does not pass on msg.topic that is a numeric value, only pass on string value." do you mean when you press the inject node that feeds the ui-button node or when you just flip the switch on the dashboard?

what version of NR are you running?  
what version of the dashboard node are you running?

If you flip the switch on the dashboard there will be no msg.topic value generated since it is creating a new msg object.

---

<div class="post-metadata">

### Author: ![rxunique](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rxunique/32/70140_2.png) [@rxunique](https://discourse.nodered.org/u/rxunique)
#### Post date: [19 November 2022 20:32 UTC](https://discourse.nodered.org/t/dashboard-node-does-not-pass-on-msg-topic-that-is-a-number/70863/4 "2022-11-19T20:32:56Z")

</div>

I don't fully understand how node-red memory/data store in memory works yet, but here's a more detailed test result

Step1. inject timestamp with topic as number, topic pass through the switch node as number  
Step2. inject timestamp with topic as string, topic pass through the switch node as string  
Step3. toggle the string switch in ui page, either on or off, topic pass through the switch node as string  
Step4. toggle the number switch in ui page, either on or off, **topic does not pass**

19 Nov 20:14:34 - [info] Node-RED version: v3.0.2  
19 Nov 20:14:34 - [info] Node.js version: v18.12.1  
19 Nov 20:14:34 - [info] Windows\_NT 10.0.22621 x64 LE  
19 Nov 20:14:35 - [info] Loading palette nodes  
19 Nov 20:14:37 - [info] Dashboard version 3.2.0 started at /ui

```auto
[
    {
        "id": "b96bd8b5a5db8dd3",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "19d3920d92883087",
        "type": "inject",
        "z": "b96bd8b5a5db8dd3",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "v": "0",
                "vt": "num"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 220,
        "y": 120,
        "wires": [
            [
                "b97be716cfbe6cd2",
                "f5de58d57a08fa9a"
            ]
        ]
    },
    {
        "id": "9aa3e16f74a36f01",
        "type": "debug",
        "z": "b96bd8b5a5db8dd3",
        "name": "debug 6",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 620,
        "y": 120,
        "wires": []
    },
    {
        "id": "b97be716cfbe6cd2",
        "type": "debug",
        "z": "b96bd8b5a5db8dd3",
        "name": "debug 7",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 420,
        "y": 180,
        "wires": []
    },
    {
        "id": "f5de58d57a08fa9a",
        "type": "ui_switch",
        "z": "b96bd8b5a5db8dd3",
        "name": "",
        "label": "Number no topic",
        "tooltip": "",
        "group": "8a2eb87d8e2bccbb",
        "order": 24,
        "width": 0,
        "height": 0,
        "passthru": true,
        "decouple": "false",
        "topic": "topic",
        "topicType": "msg",
        "style": "",
        "onvalue": "true",
        "onvalueType": "bool",
        "onicon": "",
        "oncolor": "",
        "offvalue": "false",
        "offvalueType": "bool",
        "officon": "",
        "offcolor": "",
        "animate": false,
        "className": "",
        "x": 440,
        "y": 120,
        "wires": [
            [
                "9aa3e16f74a36f01"
            ]
        ]
    },
    {
        "id": "14a403cd2558226a",
        "type": "inject",
        "z": "b96bd8b5a5db8dd3",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "0",
        "payload": "",
        "payloadType": "date",
        "x": 230,
        "y": 260,
        "wires": [
            [
                "bbf87f5763dbfe89",
                "f7042246de796dfd"
            ]
        ]
    },
    {
        "id": "32a35a44605ffde0",
        "type": "debug",
        "z": "b96bd8b5a5db8dd3",
        "name": "debug 8",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 640,
        "y": 260,
        "wires": []
    },
    {
        "id": "bbf87f5763dbfe89",
        "type": "debug",
        "z": "b96bd8b5a5db8dd3",
        "name": "debug 9",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "true",
        "targetType": "full",
        "statusVal": "",
        "statusType": "auto",
        "x": 420,
        "y": 320,
        "wires": []
    },
    {
        "id": "f7042246de796dfd",
        "type": "ui_switch",
        "z": "b96bd8b5a5db8dd3",
        "name": "",
        "label": "String with topic",
        "tooltip": "",
        "group": "8a2eb87d8e2bccbb",
        "order": 24,
        "width": 0,
        "height": 0,
        "passthru": true,
        "decouple": "false",
        "topic": "topic",
        "topicType": "msg",
        "style": "",
        "onvalue": "true",
        "onvalueType": "bool",
        "onicon": "",
        "oncolor": "",
        "offvalue": "false",
        "offvalueType": "bool",
        "officon": "",
        "offcolor": "",
        "animate": false,
        "className": "",
        "x": 440,
        "y": 260,
        "wires": [
            [
                "32a35a44605ffde0"
            ]
        ]
    },
    {
        "id": "7ea1a085ecdfcc63",
        "type": "comment",
        "z": "b96bd8b5a5db8dd3",
        "name": "Number",
        "info": "",
        "x": 190,
        "y": 80,
        "wires": []
    },
    {
        "id": "1d500d8b29dcba08",
        "type": "comment",
        "z": "b96bd8b5a5db8dd3",
        "name": "String",
        "info": "",
        "x": 190,
        "y": 220,
        "wires": []
    },
    {
        "id": "8a2eb87d8e2bccbb",
        "type": "ui_group",
        "name": "test",
        "tab": "dbf28c5fd1b0a6a4",
        "order": 1,
        "disp": true,
        "width": "6",
        "collapse": false,
        "className": ""
    },
    {
        "id": "dbf28c5fd1b0a6a4",
        "type": "ui_tab",
        "name": "test",
        "icon": "dashboard",
        "disabled": false,
        "hidden": false
    }
]

```

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [19 November 2022 21:51 UTC](https://discourse.nodered.org/t/dashboard-node-does-not-pass-on-msg-topic-that-is-a-number/70863/5 "2022-11-19T21:51:05Z")

</div>

It is only not passing the topic if the number is zero. change it to 1 or 456 and it will be passed thru.

So the real issue is that if a msg - with a topic of numeric 0 - is passed to the switch node, flipping the switch in the dashboard does not result in a topic appearing in the msg coming out of the ui-switch node. All other positive or negative numbers do pass thru.

I did test the button node and it does pass thru 0.

Looks like you found a strange edge case 👍

@dceejay David and comments on this?

---

<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: [19 November 2022 21:57 UTC](https://discourse.nodered.org/t/dashboard-node-does-not-pass-on-msg-topic-that-is-a-number/70863/6 "2022-11-19T21:57:09Z")

</div>

> [@zenofmud](#):
>
> It is only not passing the topic if the number is zero

That was my theory...

> [@Steve-Mcl](#):
>
> Does it pass a number less than or greater than zero

Looks like JavaScript falsey weirdness strikes again.

I wonder if someone would be kind enough to raise an issue please?

---

<div class="post-metadata">

### Author: ![zenofmud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/zenofmud/32/316_2.png) [@zenofmud](https://discourse.nodered.org/u/zenofmud)
#### Post date: [19 November 2022 23:14 UTC](https://discourse.nodered.org/t/dashboard-node-does-not-pass-on-msg-topic-that-is-a-number/70863/7 "2022-11-19T23:14:24Z")

</div>

Issue raised: [topic value of numeric 0 passed to ue-switch oes not show when switch toggled · Issue #784 · node-red/node-red-dashboard · GitHub](https://github.com/node-red/node-red-dashboard/issues/784)

---

<div class="post-metadata">

### Author: ![rxunique](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rxunique/32/70140_2.png) [@rxunique](https://discourse.nodered.org/u/rxunique)
#### Post date: [20 November 2022 19:50 UTC](https://discourse.nodered.org/t/dashboard-node-does-not-pass-on-msg-topic-that-is-a-number/70863/8 "2022-11-20T19:50:32Z")

</div>

Thanks guys for further testing and raising the bug

---

<div class="post-metadata">

### Author: ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)
#### Post date: [20 November 2022 23:01 UTC](https://discourse.nodered.org/t/dashboard-node-does-not-pass-on-msg-topic-that-is-a-number/70863/9 "2022-11-20T23:01:55Z")

</div>

Thanks for finding it !

---

<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: [19 January 2023 23:02 UTC](https://discourse.nodered.org/t/dashboard-node-does-not-pass-on-msg-topic-that-is-a-number/70863/10 "2023-01-19T23:02:25Z")

</div>

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