# Testing Message - eui - Must be true

**URL:** <https://discourse.nodered.org/t/testing-message-eui-must-be-true/30071>\
**Category:** General\
**Created:** [14 July 2020 16:18 UTC](https://discourse.nodered.org/t/testing-message-eui-must-be-true/30071 "2020-07-14T16:18:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![ScheepersJohan](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/scheepersjohan/32/39556_2.png) [@ScheepersJohan](https://discourse.nodered.org/u/ScheepersJohan)\
**Post date:** [14 July 2020 16:18 UTC](https://discourse.nodered.org/t/testing-message-eui-must-be-true/30071/1 "2020-07-14T16:18:11Z")

</div>

I have a msg.payload = eui-xxxxxxxxxx

I only want the pass on the message if it starts with eui.

If the message does not start with eui it needs to be blocked.

Were thinking along the line of function node with , buttt:

var output = msg.payload.split("-");  
var e = parseFloat(output[0]);  
if (e = "eui") {  
return msg;

```
}
else {

```

}

Any help will be appreciated.  
Thanks

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [14 July 2020 16:42 UTC](https://discourse.nodered.org/t/testing-message-eui-must-be-true/30071/2 "2020-07-14T16:42:01Z")

</div>

Use a switch node

 ![Screenshot 2020-07-14 at 18.41.13](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/4/c4799dff81c3b1d24f4fc437c8163fde75c8ec5f.jpeg)

Only connect output 2.

---

<div class="post-metadata">

**Author:** ![ScheepersJohan](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/scheepersjohan/32/39556_2.png) [@ScheepersJohan](https://discourse.nodered.org/u/ScheepersJohan)\
**Post date:** [14 July 2020 17:03 UTC](https://discourse.nodered.org/t/testing-message-eui-must-be-true/30071/3 "2020-07-14T17:03:00Z")

</div>

Hi,

Thank you for your help......SOLVED

🙂

---

<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:** [14 July 2020 20:21 UTC](https://discourse.nodered.org/t/testing-message-eui-must-be-true/30071/4 "2020-07-14T20:21:34Z")

</div>

Just to note that doesn't quite do what you asked. You specifically required that the string _starts_ with "eui-" but the Switch node will pass any message that contains "eui-" anywhere in the string even if it does not start with that. So it would pass "eui-xxxx" but also aeui-xxxxx

---

<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:** [12 September 2020 20:21 UTC](https://discourse.nodered.org/t/testing-message-eui-must-be-true/30071/5 "2020-09-12T20:21:36Z")

</div>

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