# Switch with undefined property?

**URL:** https://discourse.nodered.org/t/switch-with-undefined-property/3755
**Category:** Feature Requests
**Created:** [7 October 2018 11:56 UTC](https://discourse.nodered.org/t/switch-with-undefined-property/3755 "2018-10-07T11:56:56Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [7 October 2018 11:56 UTC](https://discourse.nodered.org/t/switch-with-undefined-property/3755/1 "2018-10-07T11:56:56Z")

</div>

Just noticed something about the switch node and I'm not sure that it is quite right. Or at least not quite as expected from the help.

```json
[{"id":"100238f1.3386f7","type":"inject","z":"fa3e1078.ef619","name":"","topic":"","payload":"","payloadType":"date","repeat":"60","crontab":"","once":true,"onceDelay":"1","x":150,"y":60,"wires":[["a6eea325.3ec1b"]]},{"id":"a6eea325.3ec1b","type":"switch","z":"fa3e1078.ef619","name":"","property":"fred","propertyType":"msg","rules":[{"t":"eq","v":"naff","vt":"str"},{"t":"null"},{"t":"else"}],"checkall":"true","repair":false,"outputs":3,"x":290,"y":60,"wires":[["b3d407bb.ef2c58"],["e76ff861.4c1448"],["5817b2f6.8024bc","8b5bd9d7.f1a218"]]},{"id":"b3d407bb.ef2c58","type":"debug","z":"fa3e1078.ef619","name":"Is present?","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":490,"y":40,"wires":[]},{"id":"e76ff861.4c1448","type":"debug","z":"fa3e1078.ef619","name":"Is Null?","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":480,"y":80,"wires":[]},{"id":"8b5bd9d7.f1a218","type":"debug","z":"fa3e1078.ef619","name":"Otherwise?","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","x":490,"y":120,"wires":[]}]

```

The above creates a very simple flow with a trigger, switch and 3 outputs.

The switch is testing a non-existing property of msg. The output happens against the "Is Null?" test. I can kind of see why, there is no property to match on and therefore it might be considered null.

However, the help for the switch node states:

> The `is true/false` and `is null` rules perform strict comparisons against those types. They do not convert between types.

But that isn't what is happening is it?

Anyway, my request is - _should there be an "Is Undefined" test separate to the "Is Null" one_?

If not, should the help for the switch node be updated to show that "Is Null" is also triggered if the property being tested doesn't exist.

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [14 October 2018 11:02 UTC](https://discourse.nodered.org/t/switch-with-undefined-property/3755/2 "2018-10-14T11:02:54Z")

</div>

- Bump -

Anyone?

---

<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: [14 October 2018 11:45 UTC](https://discourse.nodered.org/t/switch-with-undefined-property/3755/3 "2018-10-14T11:45:59Z")

</div>

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

---

<div class="post-metadata">

### Author: ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)
#### Post date: [14 October 2018 11:48 UTC](https://discourse.nodered.org/t/switch-with-undefined-property/3755/4 "2018-10-14T11:48:31Z")

</div>

Doh! 🤦🏽‍♂️ 😳

When did that appear and how come I'm daft enough not to have spotted it! (Hint: no need to answer the second part).

---

<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: [14 October 2018 11:49 UTC](https://discourse.nodered.org/t/switch-with-undefined-property/3755/5 "2018-10-14T11:49:26Z")

</div>

let you off as it's le weekend.
