Joinノードは、複数のメッセージを1つのメッセージに結合するノードです。
日常生活で例えると、パズルのピースを組み合わせて1枚の絵を完成させるようなものです。
msg.parts = {
id: "abc123", // 分割グループの識別子
index: 0, // このメッセージの順番(0から)
count: 3, // 総分割数
type: "array", // 元のデータ型
key: "Apple" // オブジェクト分割時のキー名
}
サンプルフローは、Node-RED本体に同梱されている公式サンプル3つ(「Automatic join mode」「Manual join mode」「Reduce sequence mode」)を1つのタブにまとめ、名前の無かった inject ノードと debug ノードに日本語の名前を付けたものです。エディタの メニュー → 読み込み → サンプル → node-red → sequence → join からも、元の3つを開けます。
📋 サンプルフロー(クリックで展開)
参照元:NodeREDエディター内サンプルフロー
[
{
"id": "7c9d326a56fe84a8",
"type": "tab",
"label": "join",
"disabled": false,
"info": "",
"env": []
},
{
"id": "afe74de5.58488",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "Example: Automatic Mode",
"info": "Join node can be used to join payload of messages into single message payload. In automatic mode, it uses `parts` property to decide sequence of messages to join.",
"x": 150,
"y": 60,
"wires": []
},
{
"id": "d0c8c78e.1281e8",
"type": "inject",
"z": "7c9d326a56fe84a8",
"name": "例1: 実行",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 200,
"y": 180,
"wires": [
[
"c59ac70d.bb9c58"
]
]
},
{
"id": "c59ac70d.bb9c58",
"type": "template",
"z": "7c9d326a56fe84a8",
"name": "data",
"field": "payload",
"fieldType": "msg",
"format": "text",
"syntax": "plain",
"template": "Apple\nOrange\nBanana\nKiwi",
"output": "str",
"x": 350,
"y": 180,
"wires": [
[
"21829618.af5b0a"
]
]
},
{
"id": "d6c9fe0.d34ad",
"type": "join",
"z": "7c9d326a56fe84a8",
"name": "",
"mode": "auto",
"build": "string",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": "\\n",
"joinerType": "str",
"accumulate": "false",
"timeout": "",
"count": "",
"reduceRight": false,
"x": 630,
"y": 180,
"wires": [
[
"8defdbb8.aa9c08"
]
]
},
{
"id": "21829618.af5b0a",
"type": "split",
"z": "7c9d326a56fe84a8",
"name": "",
"splt": "\\n",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 490,
"y": 180,
"wires": [
[
"d6c9fe0.d34ad"
]
]
},
{
"id": "8defdbb8.aa9c08",
"type": "debug",
"z": "7c9d326a56fe84a8",
"name": "例1: 結果",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 790,
"y": 180,
"wires": []
},
{
"id": "d96759bf.eabe38",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "Join message sequence created by split node",
"info": "",
"x": 250,
"y": 120,
"wires": []
},
{
"id": "a46bcdd3.db621",
"type": "csv",
"z": "7c9d326a56fe84a8",
"name": "",
"sep": ",",
"hdrin": true,
"hdrout": "",
"multi": "one",
"ret": "\\n",
"temp": "",
"skip": "0",
"strings": true,
"include_empty_strings": "",
"include_null_values": "",
"x": 490,
"y": 340,
"wires": [
[
"5d1c8a1e.691f74"
]
]
},
{
"id": "65bf1807.dafad8",
"type": "inject",
"z": "7c9d326a56fe84a8",
"name": "例2: 実行",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 200,
"y": 340,
"wires": [
[
"3640a5ef.f1e0ea"
]
]
},
{
"id": "3640a5ef.f1e0ea",
"type": "template",
"z": "7c9d326a56fe84a8",
"name": "data",
"field": "payload",
"fieldType": "msg",
"format": "text",
"syntax": "plain",
"template": "name,price\nApple,100\nOrange,80\nBanana,120\nKiwi,50",
"output": "str",
"x": 350,
"y": 340,
"wires": [
[
"a46bcdd3.db621"
]
]
},
{
"id": "5d1c8a1e.691f74",
"type": "join",
"z": "7c9d326a56fe84a8",
"name": "",
"mode": "auto",
"build": "string",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": "\\n",
"joinerType": "str",
"accumulate": "false",
"timeout": "",
"count": "",
"reduceRight": false,
"x": 630,
"y": 340,
"wires": [
[
"457ab3c9.7301ec"
]
]
},
{
"id": "457ab3c9.7301ec",
"type": "debug",
"z": "7c9d326a56fe84a8",
"name": "例2: 結果",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 790,
"y": 340,
"wires": []
},
{
"id": "d9f508c1.916c18",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "Join message sequence created by csv node",
"info": "",
"x": 250,
"y": 280,
"wires": []
},
{
"id": "28970739.29e728",
"type": "csv",
"z": "7c9d326a56fe84a8",
"name": "",
"sep": ",",
"hdrin": true,
"hdrout": "",
"multi": "one",
"ret": "\\n",
"temp": "",
"skip": "0",
"strings": true,
"include_empty_strings": "",
"include_null_values": "",
"x": 490,
"y": 500,
"wires": [
[
"bbc984d8.be42d8"
]
]
},
{
"id": "c8297669.559348",
"type": "inject",
"z": "7c9d326a56fe84a8",
"name": "例3: 実行",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 200,
"y": 500,
"wires": [
[
"2f8f819f.3371be"
]
]
},
{
"id": "2f8f819f.3371be",
"type": "template",
"z": "7c9d326a56fe84a8",
"name": "data",
"field": "payload",
"fieldType": "msg",
"format": "text",
"syntax": "plain",
"template": "name,price\nApple,100\nOrange,80\nBanana,120\nKiwi,50",
"output": "str",
"x": 350,
"y": 500,
"wires": [
[
"28970739.29e728"
]
]
},
{
"id": "716ea12e.1edb6",
"type": "join",
"z": "7c9d326a56fe84a8",
"name": "",
"mode": "auto",
"build": "string",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": "\\n",
"joinerType": "str",
"accumulate": "false",
"timeout": "",
"count": "",
"reduceRight": false,
"x": 770,
"y": 500,
"wires": [
[
"967a8991.a09208"
]
]
},
{
"id": "967a8991.a09208",
"type": "debug",
"z": "7c9d326a56fe84a8",
"name": "例3: 結果",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 930,
"y": 500,
"wires": []
},
{
"id": "332b2da9.4bc242",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "Join message sequence filtered by switch node",
"info": "",
"x": 260,
"y": 440,
"wires": []
},
{
"id": "bbc984d8.be42d8",
"type": "switch",
"z": "7c9d326a56fe84a8",
"name": "",
"property": "payload.price",
"propertyType": "msg",
"rules": [
{
"t": "gte",
"v": "100",
"vt": "num"
}
],
"checkall": "true",
"repair": true,
"outputs": 1,
"x": 630,
"y": 500,
"wires": [
[
"716ea12e.1edb6"
]
]
},
{
"id": "6ff91f94.438e2",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "↑ split input text data into message sequence",
"info": "",
"x": 610,
"y": 220,
"wires": []
},
{
"id": "9de138c7.480f08",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "↓ automatically join message sequence using parts property",
"info": "",
"x": 800,
"y": 140,
"wires": []
},
{
"id": "f06b21f.1d748e",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "↓ automatically join message sequence using parts property",
"info": "",
"x": 800,
"y": 300,
"wires": []
},
{
"id": "e0075028.900bb",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "↑ split input csv data into message sequence of rows",
"info": "",
"x": 640,
"y": 380,
"wires": []
},
{
"id": "1a390528.cf792b",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "↑ split input csv data into message sequence of rows",
"info": "",
"x": 640,
"y": 580,
"wires": []
},
{
"id": "eb05ee61.9e266",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "↓ automatically join message sequence using parts property",
"info": "",
"x": 940,
"y": 460,
"wires": []
},
{
"id": "33575fc6.e9b07",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "↑ filter message seuqnce and create new sequence",
"info": "",
"x": 770,
"y": 540,
"wires": []
},
{
"id": "7bf47d74.b233b4",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "Example: Manual Mode",
"info": "Join node can be used to join payload of messages into single message payload. In manual mode, it can uses number of messages, duration of time, or `msg.complete` property to decide sequence of messages to join. The data format of the join result can also be selected.",
"x": 140,
"y": 680,
"wires": []
},
{
"id": "7f104f68.aecff",
"type": "inject",
"z": "7c9d326a56fe84a8",
"name": "例4: 実行",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 200,
"y": 800,
"wires": [
[
"ed0381d3.e25fc"
]
]
},
{
"id": "ed0381d3.e25fc",
"type": "template",
"z": "7c9d326a56fe84a8",
"name": "data",
"field": "payload",
"fieldType": "msg",
"format": "text",
"syntax": "plain",
"template": "Apple\nOrange\nBanana\nKiwi",
"output": "str",
"x": 350,
"y": 800,
"wires": [
[
"12b322b7.78f48d"
]
]
},
{
"id": "a4f5546e.28b268",
"type": "join",
"z": "7c9d326a56fe84a8",
"name": "",
"mode": "custom",
"build": "string",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": ",",
"joinerType": "str",
"accumulate": false,
"timeout": "",
"count": "2",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "",
"reduceFixup": "",
"x": 630,
"y": 800,
"wires": [
[
"e3e636ab.5c5068"
]
]
},
{
"id": "12b322b7.78f48d",
"type": "split",
"z": "7c9d326a56fe84a8",
"name": "",
"splt": "\\n",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 490,
"y": 800,
"wires": [
[
"a4f5546e.28b268"
]
]
},
{
"id": "e3e636ab.5c5068",
"type": "debug",
"z": "7c9d326a56fe84a8",
"name": "例4: 結果",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 790,
"y": 800,
"wires": []
},
{
"id": "6a104137.204b3",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "Join two consecutive messages into single message",
"info": "",
"x": 270,
"y": 740,
"wires": []
},
{
"id": "d91412a1.eb2fa",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "↑ split input text data into messages",
"info": "",
"x": 580,
"y": 840,
"wires": []
},
{
"id": "db100cd0.4cfdd",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "↓ manually join message sequence by ','",
"info": "",
"x": 740,
"y": 760,
"wires": []
},
{
"id": "d873311b.ab6f8",
"type": "inject",
"z": "7c9d326a56fe84a8",
"name": "例5: 実行",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 200,
"y": 960,
"wires": [
[
"854ae07c.1b88f"
]
]
},
{
"id": "854ae07c.1b88f",
"type": "template",
"z": "7c9d326a56fe84a8",
"name": "data",
"field": "payload",
"fieldType": "msg",
"format": "text",
"syntax": "plain",
"template": "Apple\nOrange\nBanana\nKiwi",
"output": "str",
"x": 350,
"y": 960,
"wires": [
[
"4da6db2a.a610f4"
]
]
},
{
"id": "5c158c02.fcd224",
"type": "join",
"z": "7c9d326a56fe84a8",
"name": "",
"mode": "custom",
"build": "string",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": ",",
"joinerType": "str",
"accumulate": false,
"timeout": "2",
"count": "",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "",
"reduceFixup": "",
"x": 790,
"y": 960,
"wires": [
[
"659414e8.e901fc"
]
]
},
{
"id": "4da6db2a.a610f4",
"type": "split",
"z": "7c9d326a56fe84a8",
"name": "",
"splt": "\\n",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 490,
"y": 960,
"wires": [
[
"8e4f1c67.cdac4"
]
]
},
{
"id": "659414e8.e901fc",
"type": "debug",
"z": "7c9d326a56fe84a8",
"name": "例5: 結果",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 950,
"y": 960,
"wires": []
},
{
"id": "c002f9d0.a04128",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "Join messages received within specified time range into single message",
"info": "",
"x": 330,
"y": 900,
"wires": []
},
{
"id": "3b62f93e.ad2af6",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "↑ split input text data into messages",
"info": "",
"x": 580,
"y": 1000,
"wires": []
},
{
"id": "db741240.4d6a1",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "↓ manually join message received withn 2 secs",
"info": "",
"x": 920,
"y": 920,
"wires": []
},
{
"id": "8e4f1c67.cdac4",
"type": "delay",
"z": "7c9d326a56fe84a8",
"name": "",
"pauseType": "rate",
"timeout": "1",
"timeoutUnits": "seconds",
"rate": "1",
"nbRateUnits": "1",
"rateUnits": "second",
"randomFirst": "1",
"randomLast": "5",
"randomUnits": "seconds",
"drop": false,
"x": 650,
"y": 960,
"wires": [
[
"5c158c02.fcd224"
]
]
},
{
"id": "53363c0f.836454",
"type": "inject",
"z": "7c9d326a56fe84a8",
"name": "例6: 実行",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 200,
"y": 1140,
"wires": [
[
"33d9801f.5edc6"
]
]
},
{
"id": "33d9801f.5edc6",
"type": "template",
"z": "7c9d326a56fe84a8",
"name": "data",
"field": "payload",
"fieldType": "msg",
"format": "text",
"syntax": "plain",
"template": "Apple\nOrange\nBanana\nKiwi",
"output": "str",
"x": 350,
"y": 1140,
"wires": [
[
"46fb1122.a49b"
]
]
},
{
"id": "e5d7310a.8ba39",
"type": "join",
"z": "7c9d326a56fe84a8",
"name": "",
"mode": "custom",
"build": "string",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": ",",
"joinerType": "str",
"accumulate": false,
"timeout": "",
"count": "",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "",
"reduceFixup": "",
"x": 850,
"y": 1140,
"wires": [
[
"d1a98ee5.3a55"
]
]
},
{
"id": "46fb1122.a49b",
"type": "split",
"z": "7c9d326a56fe84a8",
"name": "",
"splt": "\\n",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 490,
"y": 1140,
"wires": [
[
"f32b7544.10b328"
]
]
},
{
"id": "d1a98ee5.3a55",
"type": "debug",
"z": "7c9d326a56fe84a8",
"name": "例6: 結果",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 1010,
"y": 1140,
"wires": []
},
{
"id": "48f547c0.063278",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "Join messages into single message using msg.complete",
"info": "",
"x": 290,
"y": 1060,
"wires": []
},
{
"id": "8106b831.3374e8",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "↑ split input text data into messages",
"info": "",
"x": 580,
"y": 1180,
"wires": []
},
{
"id": "373877fe.60a0d8",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "↓ manually join message sequence by msg.complete",
"info": "",
"x": 1000,
"y": 1100,
"wires": []
},
{
"id": "f32b7544.10b328",
"type": "function",
"z": "7c9d326a56fe84a8",
"name": "set msg.complete",
"func": "var payload = msg.payload;\nif ((payload === \"Banana\") || (payload === \"Kiwi\")) {\n msg.complete = true;\n}\nreturn msg;",
"outputs": 1,
"noerr": 0,
"x": 670,
"y": 1140,
"wires": [
[
"e5d7310a.8ba39"
]
]
},
{
"id": "90140dad.9cbd9",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "↓ set msg.complete for Banana and Kiwi",
"info": "",
"x": 740,
"y": 1060,
"wires": []
},
{
"id": "ead0afb6.a4763",
"type": "inject",
"z": "7c9d326a56fe84a8",
"name": "例7: 実行",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 200,
"y": 1300,
"wires": [
[
"175c6d3f.b71893"
]
]
},
{
"id": "175c6d3f.b71893",
"type": "template",
"z": "7c9d326a56fe84a8",
"name": "data",
"field": "payload",
"fieldType": "msg",
"format": "text",
"syntax": "plain",
"template": "Apple\nOrange\nBanana\nKiwi",
"output": "str",
"x": 350,
"y": 1300,
"wires": [
[
"3a873d4a.fcc3a2"
]
]
},
{
"id": "88c0baeb.0f4c88",
"type": "join",
"z": "7c9d326a56fe84a8",
"name": "",
"mode": "custom",
"build": "array",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": ",",
"joinerType": "str",
"accumulate": false,
"timeout": "",
"count": "2",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "",
"reduceFixup": "",
"x": 630,
"y": 1300,
"wires": [
[
"758b3990.2442c8"
]
]
},
{
"id": "3a873d4a.fcc3a2",
"type": "split",
"z": "7c9d326a56fe84a8",
"name": "",
"splt": "\\n",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 490,
"y": 1300,
"wires": [
[
"88c0baeb.0f4c88"
]
]
},
{
"id": "758b3990.2442c8",
"type": "debug",
"z": "7c9d326a56fe84a8",
"name": "例7: 結果",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 790,
"y": 1300,
"wires": []
},
{
"id": "9b1551a8.97d09",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "Join two consecutive messages into single message of array",
"info": "",
"x": 300,
"y": 1240,
"wires": []
},
{
"id": "655d7318.217b3c",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "↑ split input text data into messages",
"info": "",
"x": 580,
"y": 1340,
"wires": []
},
{
"id": "66cdfd.5cba2204",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "↓ manually join message sequence to array",
"info": "",
"x": 740,
"y": 1260,
"wires": []
},
{
"id": "be206cc6.f8141",
"type": "inject",
"z": "7c9d326a56fe84a8",
"name": "例8: 実行",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 200,
"y": 1520,
"wires": [
[
"af8f52e6.e3d2f"
]
]
},
{
"id": "af8f52e6.e3d2f",
"type": "template",
"z": "7c9d326a56fe84a8",
"name": "data",
"field": "payload",
"fieldType": "msg",
"format": "text",
"syntax": "plain",
"template": "name,price\nApple,100\nOrange,20\nBanana,80\nKiwi,120",
"output": "str",
"x": 350,
"y": 1520,
"wires": [
[
"89a32ebe.a92f1"
]
]
},
{
"id": "681800f4.06545",
"type": "join",
"z": "7c9d326a56fe84a8",
"name": "",
"mode": "custom",
"build": "object",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": ",",
"joinerType": "str",
"accumulate": false,
"timeout": "",
"count": "2",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "",
"reduceFixup": "",
"x": 830,
"y": 1520,
"wires": [
[
"8442c86.2559838"
]
]
},
{
"id": "8442c86.2559838",
"type": "debug",
"z": "7c9d326a56fe84a8",
"name": "例8: 結果",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 990,
"y": 1520,
"wires": []
},
{
"id": "d15e01f7.d0a1f",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "Merge two consecutive messages into single message of object using topic & payload ",
"info": "",
"x": 380,
"y": 1400,
"wires": []
},
{
"id": "cccc022b.dfbbc",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "↑ split input csv data into messages",
"info": "",
"x": 580,
"y": 1560,
"wires": []
},
{
"id": "65aef8f1.143ca8",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "↓ manually join message sequence to object",
"info": "",
"x": 950,
"y": 1480,
"wires": []
},
{
"id": "89a32ebe.a92f1",
"type": "csv",
"z": "7c9d326a56fe84a8",
"name": "",
"sep": ",",
"hdrin": true,
"hdrout": "",
"multi": "one",
"ret": "\\n",
"temp": "",
"skip": "0",
"strings": true,
"include_empty_strings": "",
"include_null_values": "",
"x": 480,
"y": 1520,
"wires": [
[
"39fd09fc.b87e66"
]
]
},
{
"id": "39fd09fc.b87e66",
"type": "change",
"z": "7c9d326a56fe84a8",
"name": "set topic & payload",
"rules": [
{
"t": "set",
"p": "topic",
"pt": "msg",
"to": "payload.name",
"tot": "msg"
},
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "payload.price",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 650,
"y": 1520,
"wires": [
[
"681800f4.06545"
]
]
},
{
"id": "3fe71363.c5c67c",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "↓ set topic (key) & payload (value)",
"info": "",
"x": 690,
"y": 1440,
"wires": []
},
{
"id": "3f482b62.8ec0f4",
"type": "inject",
"z": "7c9d326a56fe84a8",
"name": "例9: 実行",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 200,
"y": 1700,
"wires": [
[
"63acc875.0d1458"
]
]
},
{
"id": "63acc875.0d1458",
"type": "template",
"z": "7c9d326a56fe84a8",
"name": "data",
"field": "payload",
"fieldType": "msg",
"format": "json",
"syntax": "plain",
"template": "[\n { \"name\": \"Apple\" },\n { \"price\": 100 },\n { \"name\": \"Orange\"},\n { \"price\": 20 },\n { \"name\": \"Banana\"},\n { \"price\": 80 },\n { \"name\": \"Kiwi\"},\n { \"price\": 120 }\n]",
"output": "json",
"x": 350,
"y": 1700,
"wires": [
[
"71aa03f2.69c42c"
]
]
},
{
"id": "82b9afbd.380bd",
"type": "join",
"z": "7c9d326a56fe84a8",
"name": "",
"mode": "custom",
"build": "merged",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": ",",
"joinerType": "str",
"accumulate": false,
"timeout": "",
"count": "2",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "",
"reduceFixup": "",
"x": 630,
"y": 1700,
"wires": [
[
"df61f87d.0a7c38"
]
]
},
{
"id": "df61f87d.0a7c38",
"type": "debug",
"z": "7c9d326a56fe84a8",
"name": "例9: 結果",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 790,
"y": 1700,
"wires": []
},
{
"id": "cff7cd24.8f70a",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "Merge two consecutive messages into single message of object",
"info": "",
"x": 310,
"y": 1620,
"wires": []
},
{
"id": "c8b4d7b0.7d2048",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "↑ split array of objects data into messages",
"info": "",
"x": 600,
"y": 1740,
"wires": []
},
{
"id": "5f07dcb1.2a8384",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "↓ manually merge message sequence to object",
"info": "",
"x": 760,
"y": 1660,
"wires": []
},
{
"id": "71aa03f2.69c42c",
"type": "split",
"z": "7c9d326a56fe84a8",
"name": "",
"splt": "\\n",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 490,
"y": 1700,
"wires": [
[
"82b9afbd.380bd"
]
]
},
{
"id": "dcbdbc0e.44c81",
"type": "inject",
"z": "7c9d326a56fe84a8",
"name": "例10: 実行",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 200,
"y": 1880,
"wires": [
[
"df188870.193ec8"
]
]
},
{
"id": "df188870.193ec8",
"type": "template",
"z": "7c9d326a56fe84a8",
"name": "data",
"field": "payload",
"fieldType": "msg",
"format": "json",
"syntax": "plain",
"template": "[\n { \"name\": \"Apple\" },\n { \"price\": 100 },\n { \"order\": 5 },\n { \"order\": 1 },\n { \"order\": 20 }\n]",
"output": "json",
"x": 350,
"y": 1880,
"wires": [
[
"61df0de9.80aaa4"
]
]
},
{
"id": "77072ce9.cd2ba4",
"type": "join",
"z": "7c9d326a56fe84a8",
"name": "",
"mode": "custom",
"build": "merged",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": ",",
"joinerType": "str",
"accumulate": true,
"timeout": "",
"count": "3",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "",
"reduceFixup": "",
"x": 630,
"y": 1880,
"wires": [
[
"de78c2ec.efec3"
]
]
},
{
"id": "de78c2ec.efec3",
"type": "debug",
"z": "7c9d326a56fe84a8",
"name": "例10: 結果",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 790,
"y": 1880,
"wires": []
},
{
"id": "f2b6aab7.9f69c8",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "Merge two consecutive messages and following messages into single message of object",
"info": "",
"x": 390,
"y": 1800,
"wires": []
},
{
"id": "bf058927.d8e8b8",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "↑ split array of objects data into messages",
"info": "",
"x": 600,
"y": 1920,
"wires": []
},
{
"id": "2aab8acf.0673c6",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "↓ manually merge message sequence to object",
"info": "",
"x": 760,
"y": 1840,
"wires": []
},
{
"id": "61df0de9.80aaa4",
"type": "split",
"z": "7c9d326a56fe84a8",
"name": "",
"splt": "\\n",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 490,
"y": 1880,
"wires": [
[
"77072ce9.cd2ba4"
]
]
},
{
"id": "9279b993.ba7ed8",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "Example: Reduce Mode",
"info": "Join node can be used to reduce message sequence to single value. In reduce mode, reduce operation for a sequence can be described using JSONata expression with following special variables:\n- `$A`: the accumulated value,\n- `$I`: index of the message in the sequence,\n- `$N`: number of messages in the sequence.\n",
"x": 150,
"y": 2020,
"wires": []
},
{
"id": "e415861b.d82e38",
"type": "inject",
"z": "7c9d326a56fe84a8",
"name": "例11: 実行",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 200,
"y": 2140,
"wires": [
[
"7c8a4816.500ed8"
]
]
},
{
"id": "7c8a4816.500ed8",
"type": "template",
"z": "7c9d326a56fe84a8",
"name": "data",
"field": "payload",
"fieldType": "msg",
"format": "json",
"syntax": "plain",
"template": "[\n 1,\n 2,\n 3,\n 4,\n 5,\n 6,\n 7,\n 8,\n 9,\n 10\n]",
"output": "json",
"x": 350,
"y": 2140,
"wires": [
[
"7f64da1f.611014"
]
]
},
{
"id": "5fde318f.23897",
"type": "join",
"z": "7c9d326a56fe84a8",
"name": "",
"mode": "reduce",
"build": "string",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": ",",
"joinerType": "str",
"accumulate": false,
"timeout": "",
"count": "2",
"reduceRight": false,
"reduceExp": "$A+payload",
"reduceInit": "0",
"reduceInitType": "num",
"reduceFixup": "$A/$N",
"x": 630,
"y": 2140,
"wires": [
[
"50977eaf.0490b"
]
]
},
{
"id": "50977eaf.0490b",
"type": "debug",
"z": "7c9d326a56fe84a8",
"name": "例11: 結果",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 790,
"y": 2140,
"wires": []
},
{
"id": "57bce4bf.38d02c",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "Calculate average of message sequence",
"info": "",
"x": 240,
"y": 2080,
"wires": []
},
{
"id": "d33e73a8.5896",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "↑ split input array data into messages",
"info": "",
"x": 590,
"y": 2180,
"wires": []
},
{
"id": "34482f62.61abd",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "↓ reduce sequence to average value",
"info": "",
"x": 720,
"y": 2100,
"wires": []
},
{
"id": "7f64da1f.611014",
"type": "split",
"z": "7c9d326a56fe84a8",
"name": "",
"splt": "\\n",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 490,
"y": 2140,
"wires": [
[
"5fde318f.23897"
]
]
},
{
"id": "e051fd76.1af1e",
"type": "inject",
"z": "7c9d326a56fe84a8",
"name": "例12: 実行",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 200,
"y": 2300,
"wires": [
[
"14318520.397a9b"
]
]
},
{
"id": "14318520.397a9b",
"type": "template",
"z": "7c9d326a56fe84a8",
"name": "data",
"field": "payload",
"fieldType": "msg",
"format": "text",
"syntax": "plain",
"template": "Apple\nOrange\nBanana\nKiwi",
"output": "str",
"x": 350,
"y": 2300,
"wires": [
[
"41d85177.9b6f1"
]
]
},
{
"id": "8fac92f8.0974c",
"type": "join",
"z": "7c9d326a56fe84a8",
"name": "",
"mode": "reduce",
"build": "string",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": ",",
"joinerType": "str",
"accumulate": false,
"timeout": "",
"count": "2",
"reduceRight": false,
"reduceExp": "$append($A,[payload])",
"reduceInit": "[]",
"reduceInitType": "json",
"reduceFixup": "",
"x": 630,
"y": 2300,
"wires": [
[
"5bf98f81.6db17"
]
]
},
{
"id": "5bf98f81.6db17",
"type": "debug",
"z": "7c9d326a56fe84a8",
"name": "例12: 結果",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 790,
"y": 2300,
"wires": []
},
{
"id": "7dc61153.a9062",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "Convert message sequence to array",
"info": "",
"x": 220,
"y": 2240,
"wires": []
},
{
"id": "7f14c8b2.d775f8",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "↑ split input text data into messages",
"info": "",
"x": 580,
"y": 2340,
"wires": []
},
{
"id": "85a2470f.5b9ce8",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "↓ reduce sequence to arrray of payloads",
"info": "",
"x": 740,
"y": 2260,
"wires": []
},
{
"id": "41d85177.9b6f1",
"type": "split",
"z": "7c9d326a56fe84a8",
"name": "",
"splt": "\\n",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 490,
"y": 2300,
"wires": [
[
"8fac92f8.0974c"
]
]
},
{
"id": "ec455af2.e31cb8",
"type": "inject",
"z": "7c9d326a56fe84a8",
"name": "例13: 実行",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 200,
"y": 2460,
"wires": [
[
"693a0274.e62d6c"
]
]
},
{
"id": "693a0274.e62d6c",
"type": "template",
"z": "7c9d326a56fe84a8",
"name": "data",
"field": "payload",
"fieldType": "msg",
"format": "text",
"syntax": "plain",
"template": "Apple\nOrange\nBanana\nKiwi",
"output": "str",
"x": 350,
"y": 2460,
"wires": [
[
"d8374d2d.34863"
]
]
},
{
"id": "805c900a.c6b7c",
"type": "join",
"z": "7c9d326a56fe84a8",
"name": "",
"mode": "reduce",
"build": "string",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": ",",
"joinerType": "str",
"accumulate": false,
"timeout": "",
"count": "2",
"reduceRight": true,
"reduceExp": "$append($A,[payload])",
"reduceInit": "[]",
"reduceInitType": "json",
"reduceFixup": "",
"x": 630,
"y": 2460,
"wires": [
[
"f8be3623.b8e358"
]
]
},
{
"id": "f8be3623.b8e358",
"type": "debug",
"z": "7c9d326a56fe84a8",
"name": "例13: 結果",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 790,
"y": 2460,
"wires": []
},
{
"id": "88fe5fe0.b08ca",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "Convert message sequence to array in reverse order",
"info": "",
"x": 270,
"y": 2400,
"wires": []
},
{
"id": "f95fff12.45fda",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "↑ split input text data into messages",
"info": "",
"x": 580,
"y": 2500,
"wires": []
},
{
"id": "b7eecb8c.e6b858",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "↓ reduce sequence to arrray of payloads in reverse order",
"info": "",
"x": 790,
"y": 2420,
"wires": []
},
{
"id": "d8374d2d.34863",
"type": "split",
"z": "7c9d326a56fe84a8",
"name": "",
"splt": "\\n",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 490,
"y": 2460,
"wires": [
[
"805c900a.c6b7c"
]
]
},
{
"id": "fb404773.0eb728",
"type": "inject",
"z": "7c9d326a56fe84a8",
"name": "例14: 実行",
"topic": "",
"payload": "",
"payloadType": "date",
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"x": 200,
"y": 2620,
"wires": [
[
"8139dcd5.2300d"
]
]
},
{
"id": "8139dcd5.2300d",
"type": "template",
"z": "7c9d326a56fe84a8",
"name": "data",
"field": "payload",
"fieldType": "msg",
"format": "text",
"syntax": "plain",
"template": "Apple\nOrange\nBanana\nKiwi",
"output": "str",
"x": 350,
"y": 2620,
"wires": [
[
"c6ff515e.f95fd"
]
]
},
{
"id": "fcff950d.0f67c8",
"type": "join",
"z": "7c9d326a56fe84a8",
"name": "",
"mode": "reduce",
"build": "string",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": ",",
"joinerType": "str",
"accumulate": false,
"timeout": "",
"count": "2",
"reduceRight": false,
"reduceExp": "$append($A,[{\t \"name\": payload,\t \"index\": $I\t}])",
"reduceInit": "[]",
"reduceInitType": "json",
"reduceFixup": "",
"x": 630,
"y": 2620,
"wires": [
[
"6d082a22.2fb214"
]
]
},
{
"id": "6d082a22.2fb214",
"type": "debug",
"z": "7c9d326a56fe84a8",
"name": "例14: 結果",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"x": 790,
"y": 2620,
"wires": []
},
{
"id": "19daaf11.40d701",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "Convert message sequence to array of objects with name and index",
"info": "",
"x": 320,
"y": 2560,
"wires": []
},
{
"id": "b60f900.592e47",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "↑ split input text data into messages",
"info": "",
"x": 580,
"y": 2660,
"wires": []
},
{
"id": "62ffb2e1.28d8ec",
"type": "comment",
"z": "7c9d326a56fe84a8",
"name": "↓ reduce sequence to arrray of objects",
"info": "",
"x": 730,
"y": 2580,
"wires": []
},
{
"id": "c6ff515e.f95fd",
"type": "split",
"z": "7c9d326a56fe84a8",
"name": "",
"splt": "\\n",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 490,
"y": 2620,
"wires": [
[
"fcff950d.0f67c8"
]
]
}
]
フローには、公式サンプルの14の例が、上から順に並んでいます。「Example:」で始まる comment ノードが3つあり、その下に、join ノードの「動作」ごとの例がまとまっています。どの例も、「例N: 実行」(inject)のボタンで動かし、「例N: 結果」(debug)に結果が出ます。inject が送る値(時刻)は使われません。つなぐ元のデータは、次の「data」(template)に書いてあります。
どの例も、データをいったん1個ずつの msg に分け、join でまとめ直す作りです。分けるのは split(文字列を行ごとに、配列を要素ごとに分ける)か、csv(CSV の文字を行ごとに分ける)です。各例の上下にある「↓」「↑」付きの comment は、その下・上のノードが何をしているかの説明です。
動作: 自動
入力: "Apple" → "Orange" → "Banana" → "Kiwi" (4メッセージ)
出力: "Apple\nOrange\nBanana\nKiwi" (1メッセージ)
動作: 手動
出力: 文字列
連結文字: ,
指定数のメッセージパーツを受信後: 2
入力: "Apple" → "Orange" → "Banana" → "Kiwi"
出力: "Apple,Orange" → "Banana,Kiwi"
動作: 手動
出力: 文字列
連結文字: ,
最初のメッセージ受信からのタイムアウト後: 2(秒)
入力: 1秒間隔で "Apple" → "Orange" → "Banana" → "Kiwi"
出力: "Apple,Orange" → "Banana,Kiwi" (約2秒ごとに出力)
動作: 手動
出力: 配列
指定数のメッセージパーツを受信後: 2
入力: "Apple" → "Orange" → "Banana" → "Kiwi"
出力: ["Apple", "Orange"] → ["Banana", "Kiwi"]
動作: 手動
出力: key/valueオブジェクト
指定数のメッセージパーツを受信後: 2
入力: {topic: "Apple", payload: 100} → {topic: "Orange", payload: 20}
出力: {"Apple": 100, "Orange": 20}
動作: 列の集約(Reduce)
集約式: $A + payload
初期値: 0
最終調整式: $A / $N
入力: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10
処理: (1+2+3+4+5+6+7+8+9+10) / 10
出力: 5.5 (平均値)
温度センサー + 湿度センサー + 気圧センサー
↓
Joinノード(オブジェクト形式)
↓
{
"temperature": 25.5,
"humidity": 60,
"pressure": 1013
}
↓
データベース保存 or ダッシュボード表示
ユーザー情報API →
注文履歴API → Join(マージ)→ 統合レスポンス
在庫情報API →
出力: {
"user": {...},
"orders": [...],
"inventory": {...}
}
1時間分のログデータ(100件)
↓
Split(行ごとに分割)
↓
フィルタリング(エラーログのみ)
↓
Join(集約式: $A + 1, 初期値: 0)
↓
エラー件数: 15
工場の10台のデバイス
↓
各デバイスから生産数を受信(タイムアウト: 5秒)
↓
Join(配列形式)
↓
[120, 115, 130, 125, 110, 128, 122, 118, 132, 126]
↓
合計・平均計算 → レポート生成
// 合計
$A + payload
// 最大値
payload > $A ? payload : $A
// 配列に追加
$append($A, [payload])
// オブジェクト配列に変換
$append($A, [{"value": payload, "index": $I}])
// 条件付き加算
payload > 10 ? $A + payload : $A