That's what I am trying to do. But I want to connect multiple text nodes and selectively feed data into few of them and the once which receive the NULL value should not change there data.
My workaround is to configure the function node to have 4 outputs and selectively send data on the relevant outputs. But this workaround is quite complicated when dealing more than 5 Outputs,
Here my example:
upper part the functionality I would like to have (and don't know how to implement it in detail)
lower part my workaround.
[
{
"id": "e4fd59d6388ce474",
"type": "tab",
"label": "EmptyText",
"disabled": false,
"info": "",
"env": []
},
{
"id": "95b5b1dca3a6b5f6",
"type": "inject",
"z": "e4fd59d6388ce474",
"name": "first and second",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "12",
"payload": "",
"payloadType": "date",
"x": 140,
"y": 400,
"wires": [
[
"935c46bee3d83810",
"8a30dccddc6edfdf"
]
]
},
{
"id": "935c46bee3d83810",
"type": "function",
"z": "e4fd59d6388ce474",
"name": "Set Two Properties",
"func": "var myMsg = {};\nmyMsg.payload = {};\nmyMsg.topic = msg.topic;\n\nif (msg.topic.includes(\"1\")) {\n myMsg.payload.first = msg.payload;\n}\n\nif (msg.topic.includes(\"2\")) {\n myMsg.payload.second = msg.payload;\n}\n\nif (msg.topic.includes(\"3\")) {\n myMsg.payload.third = msg.payload;\n}\n\nreturn myMsg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 490,
"y": 220,
"wires": [
[
"4cbe53432e434550",
"2d873a5f37ee7060",
"e3d03199a3da2725",
"f193466098d68e54"
]
]
},
{
"id": "4cbe53432e434550",
"type": "debug",
"z": "e4fd59d6388ce474",
"name": "debug",
"active": false,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 710,
"y": 300,
"wires": []
},
{
"id": "9f225f850a0f5355",
"type": "inject",
"z": "e4fd59d6388ce474",
"name": "first",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "1",
"payload": "",
"payloadType": "date",
"x": 170,
"y": 240,
"wires": [
[
"935c46bee3d83810",
"8a30dccddc6edfdf"
]
]
},
{
"id": "c243adf09777690e",
"type": "inject",
"z": "e4fd59d6388ce474",
"name": "second",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "2",
"payload": "",
"payloadType": "date",
"x": 170,
"y": 280,
"wires": [
[
"935c46bee3d83810",
"8a30dccddc6edfdf"
]
]
},
{
"id": "2d873a5f37ee7060",
"type": "ui_text",
"z": "e4fd59d6388ce474",
"group": "b7d12b8d.651c8",
"order": 1,
"width": 0,
"height": 0,
"name": "first",
"label": "first",
"format": "{{msg.payload.first}}",
"layout": "row-spread",
"className": "",
"x": 710,
"y": 180,
"wires": []
},
{
"id": "e3d03199a3da2725",
"type": "ui_text",
"z": "e4fd59d6388ce474",
"group": "b7d12b8d.651c8",
"order": 2,
"width": 0,
"height": 0,
"name": "second",
"label": "second",
"format": "{{msg.payload.second}}",
"layout": "row-spread",
"className": "",
"x": 720,
"y": 220,
"wires": []
},
{
"id": "8a30dccddc6edfdf",
"type": "function",
"z": "e4fd59d6388ce474",
"name": "Set Two Properties",
"func": "var myMsg1 = {};\nvar myMsg2 = {};\nvar myMsg3 = {};\nvar mask = 0;\nmyMsg1.payload = [];\nmyMsg2.payload = [];\nmyMsg3.payload = [];\n\nif (msg.topic.includes(\"1\")) {\n myMsg1.payload = msg.payload;\n mask += 1;\n}\n\nif (msg.topic.includes(\"2\")) {\n myMsg2.payload = msg.payload;\n mask += 2;\n}\n\nif (msg.topic.includes(\"3\")) {\n myMsg3.payload = msg.payload;\n mask += 4;\n}\n\nswitch (mask) {\n case 1: return [myMsg1, [], []];\n case 2: return [[], myMsg2, []];\n case 3: return [myMsg1, myMsg2, []];\n case 4: return [[], [], myMsg3];\n case 5: return [myMsg1, [], myMsg3];\n case 6: return [[], myMsg2, myMsg3];\n case 7: return [[], myMsg2, myMsg3];\n}\n",
"outputs": 3,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 490,
"y": 540,
"wires": [
[
"2eecfa5ec406ec0e",
"35b39ebb6ca08a21"
],
[
"e82eccbb21ac25e6",
"1184441045b1f11c"
],
[
"81a888158d3a0ddf",
"415307a74a70f98a"
]
]
},
{
"id": "2eecfa5ec406ec0e",
"type": "ui_text",
"z": "e4fd59d6388ce474",
"group": "09b1797e1715fc63",
"order": 1,
"width": 0,
"height": 0,
"name": "first",
"label": "first",
"format": "{{msg.payload}}",
"layout": "row-spread",
"className": "",
"x": 710,
"y": 440,
"wires": []
},
{
"id": "e82eccbb21ac25e6",
"type": "ui_text",
"z": "e4fd59d6388ce474",
"group": "09b1797e1715fc63",
"order": 2,
"width": 0,
"height": 0,
"name": "second",
"label": "second",
"format": "{{msg.payload}}",
"layout": "row-spread",
"className": "",
"x": 720,
"y": 540,
"wires": []
},
{
"id": "6182837352813bfa",
"type": "comment",
"z": "e4fd59d6388ce474",
"name": "What I like to have",
"info": "",
"x": 490,
"y": 180,
"wires": []
},
{
"id": "179c6f3276b38d9d",
"type": "comment",
"z": "e4fd59d6388ce474",
"name": "My Workarround",
"info": "",
"x": 480,
"y": 480,
"wires": []
},
{
"id": "230ba99712228c90",
"type": "inject",
"z": "e4fd59d6388ce474",
"name": "third",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "3",
"payload": "",
"payloadType": "date",
"x": 170,
"y": 320,
"wires": [
[
"935c46bee3d83810",
"8a30dccddc6edfdf"
]
]
},
{
"id": "f193466098d68e54",
"type": "ui_text",
"z": "e4fd59d6388ce474",
"group": "b7d12b8d.651c8",
"order": 2,
"width": 0,
"height": 0,
"name": "third",
"label": "third",
"format": "{{msg.payload.third}}",
"layout": "row-spread",
"className": "",
"x": 710,
"y": 260,
"wires": []
},
{
"id": "ef7c34cae1c0c29f",
"type": "inject",
"z": "e4fd59d6388ce474",
"name": "second and third",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "23",
"payload": "",
"payloadType": "date",
"x": 140,
"y": 440,
"wires": [
[
"8a30dccddc6edfdf",
"935c46bee3d83810"
]
]
},
{
"id": "6a1deee32e832f6d",
"type": "inject",
"z": "e4fd59d6388ce474",
"name": "all",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "123",
"payload": "",
"payloadType": "date",
"x": 170,
"y": 480,
"wires": [
[
"935c46bee3d83810",
"8a30dccddc6edfdf"
]
]
},
{
"id": "81a888158d3a0ddf",
"type": "ui_text",
"z": "e4fd59d6388ce474",
"group": "09b1797e1715fc63",
"order": 2,
"width": 0,
"height": 0,
"name": "third",
"label": "third",
"format": "{{msg.payload}}",
"layout": "row-spread",
"className": "",
"x": 710,
"y": 640,
"wires": []
},
{
"id": "35b39ebb6ca08a21",
"type": "debug",
"z": "e4fd59d6388ce474",
"name": "debug1",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 720,
"y": 480,
"wires": []
},
{
"id": "1184441045b1f11c",
"type": "debug",
"z": "e4fd59d6388ce474",
"name": "debug2",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 720,
"y": 580,
"wires": []
},
{
"id": "415307a74a70f98a",
"type": "debug",
"z": "e4fd59d6388ce474",
"name": "debug3",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 720,
"y": 680,
"wires": []
},
{
"id": "b7d12b8d.651c8",
"type": "ui_group",
"name": "Example",
"tab": "fe5d396a.0d6d4",
"order": 1,
"disp": true,
"width": "6",
"collapse": false,
"className": ""
},
{
"id": "09b1797e1715fc63",
"type": "ui_group",
"name": "Workarround",
"tab": "fe5d396a.0d6d4",
"order": 2,
"disp": true,
"width": "6",
"collapse": false,
"className": ""
},
{
"id": "fe5d396a.0d6d4",
"type": "ui_tab",
"name": "Home",
"icon": "dashboard",
"disabled": false,
"hidden": false
}
]