# UI - Text Node with a function node

**URL:** https://discourse.nodered.org/t/ui-text-node-with-a-function-node/13532
**Category:** General
**Created:** [22 July 2019 02:57 UTC](https://discourse.nodered.org/t/ui-text-node-with-a-function-node/13532 "2019-07-22T02:57:38Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![niko](https://avatars.discourse-cdn.com/v4/letter/n/91b2a8/32.png) [@niko](https://discourse.nodered.org/u/niko)
#### Post date: [22 July 2019 02:57 UTC](https://discourse.nodered.org/t/ui-text-node-with-a-function-node/13532/1 "2019-07-22T02:57:38Z")

</div>

Hello there I am very new to node-red and programming in general i was wondering if there was a way to write a function before a UI - Text Node that would display the message if there was a reading but to not display anything if the answer to the function came back as undefined, many thanks

---

<div class="post-metadata">

### Author: ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)
#### Post date: [22 July 2019 07:08 UTC](https://discourse.nodered.org/t/ui-text-node-with-a-function-node/13532/2 "2019-07-22T07:08:02Z")

</div>

You can do it with a switch node, only allow the message through if it contains something.

You could do the same with an If statement in a function node. If you google “javascript if” you should find many tutorials online.

But it would also be worth reading one about javascript arrays and objects, which a fundamental to Node-RED (the w3schools one often gets recommended)

---

<div class="post-metadata">

### Author: ![niko](https://avatars.discourse-cdn.com/v4/letter/n/91b2a8/32.png) [@niko](https://discourse.nodered.org/u/niko)
#### Post date: [22 July 2019 08:57 UTC](https://discourse.nodered.org/t/ui-text-node-with-a-function-node/13532/3 "2019-07-22T08:57:31Z")

</div>

Okay I'll have a read up on those and look into switch nodes thanks for the help
