Here is the requested flow & the text file I am pulling the data from.
[
{
"id": "743cc0234f1851f1",
"type": "tab",
"label": "Flow 1",
"disabled": false,
"info": "",
"env": []
},
{
"id": "f51f30daa9fe8fb7",
"type": "group",
"z": "743cc0234f1851f1",
"name": "MANUAL TRIGGER",
"style": {
"stroke": "#ff0000",
"fill": "#ffffff",
"label": true,
"label-position": "n",
"color": "#000000"
},
"nodes": [
"3f781378483a51f6",
"182a62f9469aa974",
"99e9e83ff0d516e3",
"e345179f4c3923e0"
],
"x": 254,
"y": 109,
"w": 192,
"h": 157
},
{
"id": "3f781378483a51f6",
"type": "file in",
"z": "743cc0234f1851f1",
"g": "f51f30daa9fe8fb7",
"name": "TEST",
"filename": "C:\\Users\\PC\\Documents\\TEST.txt",
"filenameType": "str",
"format": "utf8",
"chunk": false,
"sendError": false,
"encoding": "none",
"allProps": false,
"x": 350,
"y": 175,
"wires": [
[
"99e9e83ff0d516e3"
]
]
},
{
"id": "182a62f9469aa974",
"type": "inject",
"z": "743cc0234f1851f1",
"g": "f51f30daa9fe8fb7",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 360,
"y": 150,
"wires": [
[
"3f781378483a51f6"
]
]
},
{
"id": "99e9e83ff0d516e3",
"type": "split",
"z": "743cc0234f1851f1",
"g": "f51f30daa9fe8fb7",
"name": "",
"splt": "\\n",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 370,
"y": 200,
"wires": [
[
"e345179f4c3923e0"
]
]
},
{
"id": "e345179f4c3923e0",
"type": "join",
"z": "743cc0234f1851f1",
"g": "f51f30daa9fe8fb7",
"name": "",
"mode": "custom",
"build": "array",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": " ",
"joinerType": "str",
"accumulate": false,
"timeout": "",
"count": "",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "num",
"reduceFixup": "",
"x": 370,
"y": 225,
"wires": [
[
"d1065ab4c4fd42cd"
]
]
},
{
"id": "3331fd4615f9b442",
"type": "function",
"z": "743cc0234f1851f1",
"name": "Publish",
"func": "var versionInf = msg.payload;\nflow.set('versionInf', msg.payload);\n\nfor (var b = 0; b < versionInf.length; b++) {\n var topic = 'TEST/Information/' + versionInf[b][0]; // Append the index to make the topic unique\n var payload = versionInf[b][1]\n node.send({ topic: topic, payload: payload });\n \n }\n\nreturn null",
"outputs": 1,
"timeout": "",
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1275,
"y": 225,
"wires": [
[
"f8934eaf1f046d87"
]
]
},
{
"id": "d1065ab4c4fd42cd",
"type": "split",
"z": "743cc0234f1851f1",
"name": "Split to new line",
"splt": "\\n",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 580,
"y": 225,
"wires": [
[
"03ff8d8ce3dbbe69"
]
]
},
{
"id": "6cfe2b4b8cc16828",
"type": "join",
"z": "743cc0234f1851f1",
"name": "",
"mode": "custom",
"build": "array",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": "\\n",
"joinerType": "str",
"accumulate": false,
"timeout": "",
"count": "",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "num",
"reduceFixup": "",
"x": 1090,
"y": 225,
"wires": [
[
"c3259815b458bb9b"
]
]
},
{
"id": "fba61b48e8d791d5",
"type": "function",
"z": "743cc0234f1851f1",
"name": "Replacing ",
"func": "msg.payload = msg.payload.split(' ').join(':');\nmsg.payload = msg.payload.split(' ').join(':');\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 790,
"y": 225,
"wires": [
[
"0209096a4abcaad1"
]
]
},
{
"id": "0209096a4abcaad1",
"type": "split",
"z": "743cc0234f1851f1",
"name": "Split over : ",
"splt": ":",
"spltType": "str",
"arraySplt": 1,
"arraySpltType": "len",
"stream": false,
"addname": "",
"x": 950,
"y": 225,
"wires": [
[
"6cfe2b4b8cc16828"
]
]
},
{
"id": "03ff8d8ce3dbbe69",
"type": "function",
"z": "743cc0234f1851f1",
"name": "Replacing ",
"func": "msg.payload = msg.payload.split(' :').join(':');\nmsg.payload = msg.payload.split('/').join('-');\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 595,
"y": 250,
"wires": [
[
"fba61b48e8d791d5"
]
]
},
{
"id": "c3259815b458bb9b",
"type": "join",
"z": "743cc0234f1851f1",
"name": "",
"mode": "custom",
"build": "array",
"property": "payload",
"propertyType": "msg",
"key": "topic",
"joiner": "\\n",
"joinerType": "str",
"accumulate": false,
"timeout": "",
"count": "",
"reduceRight": false,
"reduceExp": "",
"reduceInit": "",
"reduceInitType": "num",
"reduceFixup": "",
"x": 1090,
"y": 250,
"wires": [
[
"3331fd4615f9b442",
"70df2e550e8e6350"
]
]
},
{
"id": "70df2e550e8e6350",
"type": "debug",
"z": "743cc0234f1851f1",
"name": "debug 387",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 1170,
"y": 375,
"wires": []
},
{
"id": "f8934eaf1f046d87",
"type": "mqtt out",
"z": "743cc0234f1851f1",
"name": "",
"topic": "",
"qos": "",
"retain": "",
"respTopic": "",
"contentType": "",
"userProps": "",
"correl": "",
"expiry": "",
"broker": "c2f9ab517722afa0",
"x": 1425,
"y": 225,
"wires": []
},
{
"id": "c2f9ab517722afa0",
"type": "mqtt-broker",
"name": "",
"broker": "127.0.0.1",
"port": "1883",
"clientid": "MQTT Explorer",
"autoConnect": true,
"usetls": false,
"protocolVersion": "4",
"keepalive": "60",
"cleansession": true,
"autoUnsubscribe": true,
"birthTopic": "",
"birthQos": "0",
"birthPayload": "",
"birthMsg": {},
"closeTopic": "",
"closeQos": "0",
"closePayload": "",
"closeMsg": {},
"willTopic": "",
"willQos": "0",
"willPayload": "",
"willMsg": {},
"userProps": "",
"sessionExpiry": ""
}
]
TEST.txt (623 Bytes)
Let me know if you have further requests/questions regarding the flow or the desired behavior.
Thanks,
Jordan Madgett