TypeError: msg.parts.index is not a function

Hi, I'm trying to create a function that receives a split message, converts the message into variables and looks at a condition of the message to perform an action, but I always get a syntax error and I don't understand why, can someone help me correct this, thank you. here I leave the code.

var id = global.get("serial");

var s = msg.parts.index(0);
var f = msg.parts.index(1);
var e = msg.parts.index(2);

if (s == id) {
    msg.payload = + f + e;
    return msg;
else {
        msg.payload = null;


What should the brackets after index. In index there is a number. It is not an array or object - and then you need brackets. Your syntax is completely wrong.


In addition you cannot use f and e - as it can never happen - that a msg with diffferen parts.index values will reach your function. In this case - I think it makes no sense to use a split node anyway.

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