Bug in JOIN Node?

I have a problem with the JOIN Node and the complete message.
Here a flow with the 2 examples.

[
    {
        "id": "9b8e02cc37dcb236",
        "type": "split",
        "z": "a709bec85ce23ec9",
        "name": "",
        "splt": "\\n",
        "spltType": "str",
        "arraySplt": 1,
        "arraySpltType": "len",
        "stream": false,
        "addname": "",
        "x": 430,
        "y": 2220,
        "wires": [
            [
                "2905751ca86149fe"
            ]
        ]
    },
    {
        "id": "2905751ca86149fe",
        "type": "json",
        "z": "a709bec85ce23ec9",
        "name": "",
        "property": "payload.val",
        "action": "obj",
        "pretty": false,
        "x": 570,
        "y": 2220,
        "wires": [
            [
                "2c0e28f14e681cfd"
            ]
        ]
    },
    {
        "id": "f2877b240a1fc21f",
        "type": "switch",
        "z": "a709bec85ce23ec9",
        "name": "last Index?",
        "property": "parts.index",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "parts.count -1",
                "vt": "jsonata"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 750,
        "y": 2360,
        "wires": [
            [
                "022babe9323124dc"
            ]
        ]
    },
    {
        "id": "2c0e28f14e681cfd",
        "type": "change",
        "z": "a709bec85ce23ec9",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "[payload.val.lat,payload.val.lon]",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 750,
        "y": 2220,
        "wires": [
            [
                "851e03ea63234838"
            ]
        ]
    },
    {
        "id": "022babe9323124dc",
        "type": "change",
        "z": "a709bec85ce23ec9",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "complete",
                "pt": "msg",
                "to": "true",
                "tot": "bool"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 960,
        "y": 2360,
        "wires": [
            [
                "e27075061734811a"
            ]
        ]
    },
    {
        "id": "851e03ea63234838",
        "type": "join",
        "z": "a709bec85ce23ec9",
        "name": "",
        "mode": "auto",
        "build": "array",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": false,
        "timeout": "1",
        "count": "",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "",
        "reduceFixup": "",
        "x": 950,
        "y": 2220,
        "wires": [
            [
                "c4041f685b6583c3"
            ]
        ]
    },
    {
        "id": "c54bc3f682f8c4ba",
        "type": "switch",
        "z": "a709bec85ce23ec9",
        "name": "only type=location",
        "property": "payload.val._type",
        "propertyType": "msg",
        "rules": [
            {
                "t": "eq",
                "v": "location",
                "vt": "str"
            }
        ],
        "checkall": "true",
        "repair": false,
        "outputs": 1,
        "x": 750,
        "y": 2300,
        "wires": [
            [
                "816f52bdc597bed9"
            ]
        ]
    },
    {
        "id": "c4041f685b6583c3",
        "type": "debug",
        "z": "a709bec85ce23ec9",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1110,
        "y": 2220,
        "wires": []
    },
    {
        "id": "df5a25e85a2e7a7f",
        "type": "inject",
        "z": "a709bec85ce23ec9",
        "name": "Array",
        "props": [
            {
                "p": "payload"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "[{\"id\":10,\"ts\":1652943676271,\"val\":\"{\\\"_type\\\":\\\"location\\\",\\\"acc\\\":40,\\\"alt\\\":559,\\\"batt\\\":100,\\\"bs\\\":1,\\\"conn\\\":\\\"m\\\",\\\"lat\\\":51.056793,\\\"lon\\\":0.620149,\\\"m\\\":2,\\\"p\\\":95.763,\\\"t\\\":\\\"c\\\",\\\"tid\\\":\\\"MW\\\",\\\"tst\\\":1652943675,\\\"vac\\\":22}\"},{\"id\":10,\"ts\":1652945948484,\"val\":\"{\\\"_type\\\":\\\"location\\\",\\\"acc\\\":40,\\\"alt\\\":559,\\\"batt\\\":100,\\\"bs\\\":1,\\\"conn\\\":\\\"m\\\",\\\"created_at\\\":1652945947,\\\"lat\\\":51.056807,\\\"lon\\\":0.620149,\\\"m\\\":2,\\\"p\\\":95.76,\\\"t\\\":\\\"t\\\",\\\"tid\\\":\\\"MW\\\",\\\"tst\\\":1652943675,\\\"vac\\\":22}\"},{\"id\":10,\"ts\":1652945948537,\"val\":\"{\\\"_type\\\":\\\"location\\\",\\\"acc\\\":59,\\\"alt\\\":551,\\\"batt\\\":100,\\\"bs\\\":1,\\\"conn\\\":\\\"m\\\",\\\"lat\\\":51.073934,\\\"lon\\\":0.604433,\\\"m\\\":2,\\\"p\\\":95.76,\\\"tid\\\":\\\"MW\\\",\\\"tst\\\":1652945947,\\\"vac\\\":22}\"},{\"id\":10,\"ts\":1652946128185,\"val\":\"{\\\"_type\\\":\\\"location\\\",\\\"acc\\\":59,\\\"alt\\\":551,\\\"batt\\\":99,\\\"bs\\\":1,\\\"conn\\\":\\\"m\\\",\\\"created_at\\\":1652946128,\\\"lat\\\":51.073934,\\\"lon\\\":0.604433,\\\"m\\\":2,\\\"p\\\":95.815,\\\"t\\\":\\\"t\\\",\\\"tid\\\":\\\"MW\\\",\\\"tst\\\":1652945947,\\\"vac\\\":22}\"},{\"id\":10,\"ts\":1652946308170,\"val\":\"{\\\"_type\\\":\\\"location\\\",\\\"acc\\\":59,\\\"alt\\\":551,\\\"batt\\\":98,\\\"bs\\\":1,\\\"conn\\\":\\\"m\\\",\\\"created_at\\\":1652946308,\\\"lat\\\":51.073934,\\\"lon\\\":0.604433,\\\"m\\\":2,\\\"p\\\":95.816,\\\"t\\\":\\\"t\\\",\\\"tid\\\":\\\"MW\\\",\\\"tst\\\":1652945947,\\\"vac\\\":22}\"},{\"id\":10,\"ts\":1652946488296,\"val\":\"{\\\"_type\\\":\\\"dummy\\\",\\\"acc\\\":59,\\\"alt\\\":551,\\\"batt\\\":97,\\\"bs\\\":1,\\\"conn\\\":\\\"m\\\",\\\"created_at\\\":1652946488,\\\"lat\\\":51.073934,\\\"lon\\\":0.604433,\\\"m\\\":2,\\\"p\\\":95.815,\\\"t\\\":\\\"t\\\",\\\"tid\\\":\\\"MW\\\",\\\"tst\\\":1652945947,\\\"vac\\\":22}\"},{\"id\":10,\"ts\":1652946668297,\"val\":\"{\\\"_type\\\":\\\"location\\\",\\\"acc\\\":59,\\\"alt\\\":551,\\\"batt\\\":97,\\\"bs\\\":1,\\\"conn\\\":\\\"m\\\",\\\"created_at\\\":1652946668,\\\"lat\\\":51.073934,\\\"lon\\\":0.604433,\\\"m\\\":2,\\\"p\\\":95.816,\\\"t\\\":\\\"t\\\",\\\"tid\\\":\\\"MW\\\",\\\"tst\\\":1652945947,\\\"vac\\\":22}\"},{\"id\":10,\"ts\":1652946848279,\"val\":\"{\\\"_type\\\":\\\"location\\\",\\\"acc\\\":59,\\\"alt\\\":551,\\\"batt\\\":97,\\\"bs\\\":1,\\\"conn\\\":\\\"m\\\",\\\"created_at\\\":1652946848,\\\"lat\\\":51.073934,\\\"lon\\\":0.604433,\\\"m\\\":2,\\\"p\\\":95.818,\\\"t\\\":\\\"t\\\",\\\"tid\\\":\\\"MW\\\",\\\"tst\\\":1652945947,\\\"vac\\\":22}\"},{\"id\":10,\"ts\":1652947028272,\"val\":\"{\\\"_type\\\":\\\"location\\\",\\\"acc\\\":59,\\\"alt\\\":551,\\\"batt\\\":97,\\\"bs\\\":1,\\\"conn\\\":\\\"m\\\",\\\"created_at\\\":1652947028,\\\"lat\\\":51.073934,\\\"lon\\\":0.604433,\\\"m\\\":2,\\\"p\\\":95.819,\\\"t\\\":\\\"t\\\",\\\"tid\\\":\\\"MW\\\",\\\"tst\\\":1652945947,\\\"vac\\\":22}\"},{\"id\":10,\"ts\":1652947208351,\"val\":\"{\\\"_type\\\":\\\"location\\\",\\\"acc\\\":59,\\\"alt\\\":551,\\\"batt\\\":95,\\\"bs\\\":1,\\\"conn\\\":\\\"m\\\",\\\"created_at\\\":1652947208,\\\"lat\\\":51.073934,\\\"lon\\\":0.604433,\\\"m\\\":2,\\\"p\\\":95.819,\\\"t\\\":\\\"t\\\",\\\"tid\\\":\\\"MW\\\",\\\"tst\\\":1652945947,\\\"vac\\\":22}\"}]",
        "payloadType": "json",
        "x": 270,
        "y": 2260,
        "wires": [
            [
                "2aeecd599694af82",
                "9b8e02cc37dcb236"
            ]
        ]
    },
    {
        "id": "2aeecd599694af82",
        "type": "split",
        "z": "a709bec85ce23ec9",
        "name": "",
        "splt": "\\n",
        "spltType": "str",
        "arraySplt": 1,
        "arraySpltType": "len",
        "stream": false,
        "addname": "",
        "x": 430,
        "y": 2300,
        "wires": [
            [
                "e4a9051a3defdbdd"
            ]
        ]
    },
    {
        "id": "e4a9051a3defdbdd",
        "type": "json",
        "z": "a709bec85ce23ec9",
        "name": "",
        "property": "payload.val",
        "action": "obj",
        "pretty": false,
        "x": 570,
        "y": 2300,
        "wires": [
            [
                "c54bc3f682f8c4ba",
                "f2877b240a1fc21f"
            ]
        ]
    },
    {
        "id": "816f52bdc597bed9",
        "type": "change",
        "z": "a709bec85ce23ec9",
        "name": "",
        "rules": [
            {
                "t": "set",
                "p": "payload",
                "pt": "msg",
                "to": "[payload.val.lat,payload.val.lon]",
                "tot": "jsonata"
            }
        ],
        "action": "",
        "property": "",
        "from": "",
        "to": "",
        "reg": false,
        "x": 970,
        "y": 2300,
        "wires": [
            [
                "e27075061734811a"
            ]
        ]
    },
    {
        "id": "e27075061734811a",
        "type": "join",
        "z": "a709bec85ce23ec9",
        "name": "",
        "mode": "auto",
        "build": "array",
        "property": "payload",
        "propertyType": "msg",
        "key": "topic",
        "joiner": "\\n",
        "joinerType": "str",
        "accumulate": false,
        "timeout": "1",
        "count": "",
        "reduceRight": false,
        "reduceExp": "",
        "reduceInit": "",
        "reduceInitType": "",
        "reduceFixup": "",
        "x": 1170,
        "y": 2300,
        "wires": [
            [
                "d42c4b01e4e0106a"
            ]
        ]
    },
    {
        "id": "d42c4b01e4e0106a",
        "type": "debug",
        "z": "a709bec85ce23ec9",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1330,
        "y": 2300,
        "wires": []
    }
]

I have an array that is splitted and then I rejoin the messages again. So in general no problem (example 1). However if I want to filter out some messages - automatic join does not work - as some messages are missing. Correct!!

So I will send a msg.complete to release the message already collected in the JOIN Node - however the last element is an object. Should this be the case? - How can I get rid off the last object element???

When I filter out some messages I should get fewer elements. So without filtering I get 9 array elements, when I filter one out and send a complete message, I expect to get 8 array elements without an object element.

Did the message containing complete have a payload?

No nothing.

That does not mean payload was empty (it just means you didnt add a payload)

Always check with a debug node!

Try adding another row to that change node to delete msg.payload

1 Like

I have to check - you might have a point here. Wait I will check.

Ok there was an object - I deleted the payload in the lower part of the flow - and I got even more strange things. The last message and the filtered out message become undefined now.

If I delete the msg.part in the change node in the lower part - JOIN node complains, that it is missing the msg.part property.

I switch back the join node to manual it works. So not nice (I thought complete message could also work in automatic mode) - but so it is working.

So I deleted in the lower part the payload and the parts property and changed the JOIN Node to manual mode.

Many thanks!!

@mickym2 there is an option in the switch node to recreate message sequences this will allow you to use auto mode when you remove elements of the original array.

[{"id":"df5a25e85a2e7a7f","type":"inject","z":"bf9e1e33.030598","name":"Array","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"id\":10,\"ts\":1652943676271,\"val\":\"{\\\"_type\\\":\\\"location\\\",\\\"acc\\\":40,\\\"alt\\\":559,\\\"batt\\\":100,\\\"bs\\\":1,\\\"conn\\\":\\\"m\\\",\\\"lat\\\":51.056793,\\\"lon\\\":0.620149,\\\"m\\\":2,\\\"p\\\":95.763,\\\"t\\\":\\\"c\\\",\\\"tid\\\":\\\"MW\\\",\\\"tst\\\":1652943675,\\\"vac\\\":22}\"},{\"id\":10,\"ts\":1652945948484,\"val\":\"{\\\"_type\\\":\\\"location\\\",\\\"acc\\\":40,\\\"alt\\\":559,\\\"batt\\\":100,\\\"bs\\\":1,\\\"conn\\\":\\\"m\\\",\\\"created_at\\\":1652945947,\\\"lat\\\":51.056807,\\\"lon\\\":0.620149,\\\"m\\\":2,\\\"p\\\":95.76,\\\"t\\\":\\\"t\\\",\\\"tid\\\":\\\"MW\\\",\\\"tst\\\":1652943675,\\\"vac\\\":22}\"},{\"id\":10,\"ts\":1652945948537,\"val\":\"{\\\"_type\\\":\\\"location\\\",\\\"acc\\\":59,\\\"alt\\\":551,\\\"batt\\\":100,\\\"bs\\\":1,\\\"conn\\\":\\\"m\\\",\\\"lat\\\":51.073934,\\\"lon\\\":0.604433,\\\"m\\\":2,\\\"p\\\":95.76,\\\"tid\\\":\\\"MW\\\",\\\"tst\\\":1652945947,\\\"vac\\\":22}\"},{\"id\":10,\"ts\":1652946128185,\"val\":\"{\\\"_type\\\":\\\"location\\\",\\\"acc\\\":59,\\\"alt\\\":551,\\\"batt\\\":99,\\\"bs\\\":1,\\\"conn\\\":\\\"m\\\",\\\"created_at\\\":1652946128,\\\"lat\\\":51.073934,\\\"lon\\\":0.604433,\\\"m\\\":2,\\\"p\\\":95.815,\\\"t\\\":\\\"t\\\",\\\"tid\\\":\\\"MW\\\",\\\"tst\\\":1652945947,\\\"vac\\\":22}\"},{\"id\":10,\"ts\":1652946308170,\"val\":\"{\\\"_type\\\":\\\"location\\\",\\\"acc\\\":59,\\\"alt\\\":551,\\\"batt\\\":98,\\\"bs\\\":1,\\\"conn\\\":\\\"m\\\",\\\"created_at\\\":1652946308,\\\"lat\\\":51.073934,\\\"lon\\\":0.604433,\\\"m\\\":2,\\\"p\\\":95.816,\\\"t\\\":\\\"t\\\",\\\"tid\\\":\\\"MW\\\",\\\"tst\\\":1652945947,\\\"vac\\\":22}\"},{\"id\":10,\"ts\":1652946488296,\"val\":\"{\\\"_type\\\":\\\"dummy\\\",\\\"acc\\\":59,\\\"alt\\\":551,\\\"batt\\\":97,\\\"bs\\\":1,\\\"conn\\\":\\\"m\\\",\\\"created_at\\\":1652946488,\\\"lat\\\":51.073934,\\\"lon\\\":0.604433,\\\"m\\\":2,\\\"p\\\":95.815,\\\"t\\\":\\\"t\\\",\\\"tid\\\":\\\"MW\\\",\\\"tst\\\":1652945947,\\\"vac\\\":22}\"},{\"id\":10,\"ts\":1652946668297,\"val\":\"{\\\"_type\\\":\\\"location\\\",\\\"acc\\\":59,\\\"alt\\\":551,\\\"batt\\\":97,\\\"bs\\\":1,\\\"conn\\\":\\\"m\\\",\\\"created_at\\\":1652946668,\\\"lat\\\":51.073934,\\\"lon\\\":0.604433,\\\"m\\\":2,\\\"p\\\":95.816,\\\"t\\\":\\\"t\\\",\\\"tid\\\":\\\"MW\\\",\\\"tst\\\":1652945947,\\\"vac\\\":22}\"},{\"id\":10,\"ts\":1652946848279,\"val\":\"{\\\"_type\\\":\\\"location\\\",\\\"acc\\\":59,\\\"alt\\\":551,\\\"batt\\\":97,\\\"bs\\\":1,\\\"conn\\\":\\\"m\\\",\\\"created_at\\\":1652946848,\\\"lat\\\":51.073934,\\\"lon\\\":0.604433,\\\"m\\\":2,\\\"p\\\":95.818,\\\"t\\\":\\\"t\\\",\\\"tid\\\":\\\"MW\\\",\\\"tst\\\":1652945947,\\\"vac\\\":22}\"},{\"id\":10,\"ts\":1652947028272,\"val\":\"{\\\"_type\\\":\\\"location\\\",\\\"acc\\\":59,\\\"alt\\\":551,\\\"batt\\\":97,\\\"bs\\\":1,\\\"conn\\\":\\\"m\\\",\\\"created_at\\\":1652947028,\\\"lat\\\":51.073934,\\\"lon\\\":0.604433,\\\"m\\\":2,\\\"p\\\":95.819,\\\"t\\\":\\\"t\\\",\\\"tid\\\":\\\"MW\\\",\\\"tst\\\":1652945947,\\\"vac\\\":22}\"},{\"id\":10,\"ts\":1652947208351,\"val\":\"{\\\"_type\\\":\\\"location\\\",\\\"acc\\\":59,\\\"alt\\\":551,\\\"batt\\\":95,\\\"bs\\\":1,\\\"conn\\\":\\\"m\\\",\\\"created_at\\\":1652947208,\\\"lat\\\":51.073934,\\\"lon\\\":0.604433,\\\"m\\\":2,\\\"p\\\":95.819,\\\"t\\\":\\\"t\\\",\\\"tid\\\":\\\"MW\\\",\\\"tst\\\":1652945947,\\\"vac\\\":22}\"}]","payloadType":"json","x":70,"y":2220,"wires":[["2aeecd599694af82","9b8e02cc37dcb236"]]},{"id":"2aeecd599694af82","type":"split","z":"bf9e1e33.030598","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":230,"y":2260,"wires":[["e4a9051a3defdbdd"]]},{"id":"9b8e02cc37dcb236","type":"split","z":"bf9e1e33.030598","name":"","splt":"\\n","spltType":"str","arraySplt":1,"arraySpltType":"len","stream":false,"addname":"","x":230,"y":2180,"wires":[["2905751ca86149fe"]]},{"id":"e4a9051a3defdbdd","type":"json","z":"bf9e1e33.030598","name":"","property":"payload.val","action":"obj","pretty":false,"x":370,"y":2260,"wires":[["c54bc3f682f8c4ba"]]},{"id":"2905751ca86149fe","type":"json","z":"bf9e1e33.030598","name":"","property":"payload.val","action":"obj","pretty":false,"x":370,"y":2180,"wires":[["2c0e28f14e681cfd"]]},{"id":"c54bc3f682f8c4ba","type":"switch","z":"bf9e1e33.030598","name":"only type=location","property":"payload.val._type","propertyType":"msg","rules":[{"t":"eq","v":"location","vt":"str"}],"checkall":"true","repair":true,"outputs":1,"x":550,"y":2260,"wires":[["816f52bdc597bed9"]]},{"id":"2c0e28f14e681cfd","type":"change","z":"bf9e1e33.030598","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"[payload.val.lat,payload.val.lon]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":550,"y":2180,"wires":[["851e03ea63234838"]]},{"id":"816f52bdc597bed9","type":"change","z":"bf9e1e33.030598","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"[payload.val.lat,payload.val.lon]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":770,"y":2260,"wires":[["e27075061734811a"]]},{"id":"851e03ea63234838","type":"join","z":"bf9e1e33.030598","name":"","mode":"auto","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"1","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":750,"y":2180,"wires":[["c4041f685b6583c3"]]},{"id":"e27075061734811a","type":"join","z":"bf9e1e33.030598","name":"","mode":"auto","build":"array","property":"payload","propertyType":"msg","key":"topic","joiner":"\\n","joinerType":"str","accumulate":false,"timeout":"1","count":"","reduceRight":false,"reduceExp":"","reduceInit":"","reduceInitType":"","reduceFixup":"","x":970,"y":2260,"wires":[["d42c4b01e4e0106a"]]},{"id":"c4041f685b6583c3","type":"debug","z":"bf9e1e33.030598","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":910,"y":2180,"wires":[]},{"id":"d42c4b01e4e0106a","type":"debug","z":"bf9e1e33.030598","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":1130,"y":2260,"wires":[]}]
2 Likes

Wow - thanks very much! - You are the absolute master of NodeRed. Sometime I thought I would already know a lot - but you are my teacher and master of this tool. Sometimes you see the options, but you never used it. Great job you are doing here on board!!!

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