# Set 'undefined' to 0

**URL:** https://discourse.nodered.org/t/set-undefined-to-0/43044
**Category:** General
**Created:** [22 March 2021 20:34 UTC](https://discourse.nodered.org/t/set-undefined-to-0/43044 "2021-03-22T20:34:17Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![knaxman](https://avatars.discourse-cdn.com/v4/letter/k/d07c76/32.png) [@knaxman](https://discourse.nodered.org/u/knaxman)
#### Post date: [22 March 2021 20:34 UTC](https://discourse.nodered.org/t/set-undefined-to-0/43044/1 "2021-03-22T20:34:17Z")

</div>

Hi guys,

I just started some days ago with Node-RED.

I have maybe a dummy a question.

I read via http a XML file from a Converter. During daytime it works but if the converter is hybernating the power value is received a 'undefined'.

Could someone give me an hint how I have to setup a function that writes a 0 to the Output if the value is 'undefined' otherwise pass the value to the output.

```auto
22.3.2021, 21:32:47node: 31ec5315.f48fbc
msg.payload : undefined
undefined

```

---

<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: [22 March 2021 20:51 UTC](https://discourse.nodered.org/t/set-undefined-to-0/43044/2 "2021-03-22T20:51:19Z")

</div>

may I suggest a google search with 'javascript test for undefined'

---

<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: [5 April 2021 20:51 UTC](https://discourse.nodered.org/t/set-undefined-to-0/43044/3 "2021-04-05T20:51:34Z")

</div>

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