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.