Testing Message - eui - Must be true

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

Use a switch node

Only connect output 2.

2 Likes

Hi,

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

:slight_smile:

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

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