Hi
I am trying to download the ui table in csv format
But am unable to do so, any help will be appreciated
[
{
"id": "4239e513d67818ad",
"type": "inject",
"z": "a1fe963ffcba0f9a",
"name": "Generate weld",
"props": [
{
"p": "weld",
"v": "{\"p1\":null,\"p2\":null,\"p3\":null}",
"vt": "json"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"x": 260,
"y": 800,
"wires": [
[
"acb22296609c4bce",
"abed8dae9bdbe212"
]
]
},
{
"id": "abed8dae9bdbe212",
"type": "function",
"z": "a1fe963ffcba0f9a",
"name": "Generate weld parameters",
"func": "// Get the weld number\nlet weldNum = flow.get(\"weldNum\");\n\n// If init, then set it to 1\nif (weldNum === undefined) {\n weldNum = 1\n flow.set(\"weldNum\", 1);\n} else {\n// Otherwise increment each weld that is generated\n weldNum += 1\n flow.set(\"weldNum\", weldNum)\n}\n\n// Create a 'weld' with multiple parameters\nlet weld = msg.weld;\nlet numLength = 6;\n\nweld.num = weldNum;\nweld.p1 = (Math.random()).toFixed(numLength);\nweld.p2 = (Math.random() * .5).toFixed(numLength);\nweld.p3 = (Math.random() * 2).toFixed(numLength);\nweld.p4 = (Math.random() * 2).toFixed(numLength);\nweld.p5 = (Math.random() * 2).toFixed(numLength);\nweld.name = \"Weld \" + weld.num;\n\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 560,
"y": 720,
"wires": [
[
"1f43cbb06a104ac7",
"e1663bd95aa089e9"
]
]
},
{
"id": "1f43cbb06a104ac7",
"type": "function",
"z": "a1fe963ffcba0f9a",
"name": "Keep persistent table of welds",
"func": "let tableData = flow.get(\"tableData\") || [];\n\ntableData.unshift(msg.weld);\n\n\n\nmsg.tableData = tableData\n\nflow.set(\"tableData\", tableData)\nreturn msg;\n\n// // Wrapped Object (tableData) that's stored in msg\n// // Each Table has properties for each column in that part of the table to be dynamic\n// {\n// // Left Table (fixed). Key = header name, Value = Array of values in tab\n// \"left\": {\n// \"num\": [1, 2, 3, 4, 5]\n// },\n// // Center Table (scrollable). Key = header name, Value = Array of values in tab\n// \"center\": {\n// \"p1\": [1.234, 1.892, 1.429, 1.952, 1.041],\n// \"p2\": [2.587, 2.018, 2.593, 2.104, 2.501],\n// \"p3\": [3.014, 3.581, 3.590, 3.901, 3.291],\n// \"p4\": [4.104, 4.194, 4.981, 4.761, 4.385],\n// \"p5\": [5.012, 5.831, 5.123, 5.741, 5.689]\n// },\n// // Right Table (fixed). Key = header name, Value = Array of values in tab\n// \"right\": {\n// \"name\": [\"a\", \"b\", \"c\", \"d\", \"e\"]\n// }\n// }",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 830,
"y": 720,
"wires": [
[
"55548ac5744b3d38",
"302ddd18b58fcba7"
]
]
},
{
"id": "55548ac5744b3d38",
"type": "debug",
"z": "a1fe963ffcba0f9a",
"name": "TableData",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "tableData",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 1060,
"y": 780,
"wires": []
},
{
"id": "e1663bd95aa089e9",
"type": "debug",
"z": "a1fe963ffcba0f9a",
"name": "Weld",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "weld",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 770,
"y": 780,
"wires": []
},
{
"id": "c6e3576e93b962d7",
"type": "inject",
"z": "a1fe963ffcba0f9a",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 220,
"y": 1080,
"wires": [
[
"c8aa5e644299dc4e"
]
]
},
{
"id": "c8aa5e644299dc4e",
"type": "ui_template",
"z": "a1fe963ffcba0f9a",
"group": "8922194f09dd9a54",
"name": "Home page",
"order": 7,
"width": "0",
"height": "0",
"format": "<style>\n\n.box {\n width: 50vw;\n height: 50vh;\n border: \"black\";\n border-style: solid;\n}\n\n.bg {\n background-color: #e3e3e3;\n}\n \n</style>\n\n<div class=\"box bg\">\n <h1 class=\"bg\"> \n The main page\n </h1>\n</div>\n\n",
"storeOutMessages": true,
"fwdInMessages": true,
"resendOnRefresh": true,
"templateScope": "local",
"className": "",
"x": 370,
"y": 1080,
"wires": [
[]
]
},
{
"id": "5f41d81469a3aea0",
"type": "ui_etable",
"z": "a1fe963ffcba0f9a",
"payload": "[{\"formatter\":\"rowSelection\",\"titleFormatter\":\"rowSelection\",\"hozAlign\":\"center\",\"headerSort\":false,\"frozen\":true},{\"title\":\"Weld Num\",\"field\":\"num\",\"frozen\":true},{\"title\":\"Name\",\"field\":\"name\",\"align\":\"left\",\"editor\":\"input\",\"frozen\":true},{\"title\":\"P1\",\"field\":\"p1\"},{\"title\":\"P2\",\"field\":\"p2\"},{\"title\":\"P3\",\"field\":\"p3\"},{\"title\":\"P4\",\"field\":\"p4\"},{\"title\":\"P5\",\"field\":\"p5\"},{\"title\":\"Complete Weld\",\"field\":\"weldComplete\",\"width\":90,\"align\":\"center\",\"formatter\":\"tickCross\",\"sorter\":\"boolean\",\"editor\":true,\"frozen\":true},{\"title\":\"Visual Inspection\",\"field\":\"visInsp\",\"editor\":\"select\",\"editorParams\":{\"values\":[\"pass\",\"fail\"]},\"frozen\":true}]",
"payloadType": "json",
"options": "{\"movableColumns\":true,\"resizableColumns\":true,\"selectable\":5,\"responsiveLayout\":\"collapse\",\"autoResize\":true,\"layout\":\"fitColumns\",\"pagination\":\"local\",\"height\":\"70vh\"}",
"group": "c31affb830f65b0a",
"name": "",
"order": 4,
"width": 0,
"height": 0,
"columns": [],
"outputs": 1,
"cts": false,
"x": 1255,
"y": 660,
"wires": [
[
"425a2ec0c17ac8f8",
"54564d05cf3f2d53",
"89b67776c07e52bd"
]
],
"l": false
},
{
"id": "302ddd18b58fcba7",
"type": "change",
"z": "a1fe963ffcba0f9a",
"name": "",
"rules": [
{
"t": "set",
"p": "payload",
"pt": "msg",
"to": "tableData",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 1080,
"y": 720,
"wires": [
[
"5f41d81469a3aea0"
]
]
},
{
"id": "425a2ec0c17ac8f8",
"type": "function",
"z": "a1fe963ffcba0f9a",
"name": "Update table with Change",
"func": "// If the callback from the table node doesn't indicate a edited cell. Don't continue\nif (msg.callback !== \"cellEdited\") {\n return;\n}\n\n// Extract edited cell from payload\nlet editedCell = msg.payload;\nlet numEditedCell = editedCell.num;\n\n// Get the table data and swap out the old with the new\nlet tableData = flow.get(\"tableData\");\nlet originalCellIndex = tableData.findIndex(row => row.num === numEditedCell);\ntableData[originalCellIndex] = editedCell;\nflow.set(\"tableData\", tableData);\n\n// Set the payload to give back to the table node\nmsg.payload = tableData;\n\n\n\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1730,
"y": 340,
"wires": [
[]
]
},
{
"id": "f9fee590e2be195d",
"type": "ui_button",
"z": "a1fe963ffcba0f9a",
"name": "",
"group": "c31affb830f65b0a",
"order": 2,
"width": 2,
"height": 1,
"passthru": false,
"label": "Clear Table",
"tooltip": "",
"color": "",
"bgcolor": "",
"className": "",
"icon": "",
"payload": "true",
"payloadType": "bool",
"topic": "payload",
"topicType": "msg",
"x": 870,
"y": 600,
"wires": [
[
"9bd3eead4585dd2a"
]
]
},
{
"id": "9bd3eead4585dd2a",
"type": "function",
"z": "a1fe963ffcba0f9a",
"name": "Clear Table",
"func": "// Resets all table related data\nflow.set(\"tableData\", []);\nflow.set(\"weldNum\", undefined);\nmsg.payload = [];\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 1030,
"y": 600,
"wires": [
[
"5f41d81469a3aea0"
]
]
},
{
"id": "acb22296609c4bce",
"type": "ui_button",
"z": "a1fe963ffcba0f9a",
"name": "",
"group": "c31affb830f65b0a",
"order": 1,
"width": 3,
"height": 1,
"passthru": true,
"label": "Generate weld",
"tooltip": "",
"color": "",
"bgcolor": "",
"className": "",
"icon": "",
"payload": "{\"p1\":null,\"p2\":null,\"p3\":null}",
"payloadType": "json",
"topic": "weld",
"topicType": "msg",
"x": 300,
"y": 740,
"wires": [
[
"572d19d4c8a7dc98"
]
]
},
{
"id": "572d19d4c8a7dc98",
"type": "change",
"z": "a1fe963ffcba0f9a",
"name": "",
"rules": [
{
"t": "set",
"p": "weld",
"pt": "msg",
"to": "payload",
"tot": "msg"
}
],
"action": "",
"property": "",
"from": "",
"to": "",
"reg": false,
"x": 310,
"y": 680,
"wires": [
[
"abed8dae9bdbe212"
]
]
},
{
"id": "54564d05cf3f2d53",
"type": "debug",
"z": "a1fe963ffcba0f9a",
"name": "debug 3",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "true",
"targetType": "full",
"statusVal": "",
"statusType": "auto",
"x": 1800,
"y": 400,
"wires": []
},
{
"id": "1f084d4e29b09f7a",
"type": "ui_ui_control",
"z": "a1fe963ffcba0f9a",
"name": "",
"events": "all",
"x": 580,
"y": 860,
"wires": [
[]
]
},
{
"id": "a31f4f0c8064271f",
"type": "comment",
"z": "a1fe963ffcba0f9a",
"name": "Main page TEMP template",
"info": "",
"x": 250,
"y": 1020,
"wires": []
},
{
"id": "12c03fb8f3b36c73",
"type": "comment",
"z": "a1fe963ffcba0f9a",
"name": "Data Collection Page - Undocumented",
"info": "",
"x": 290,
"y": 540,
"wires": []
},
{
"id": "89b67776c07e52bd",
"type": "csv",
"z": "a1fe963ffcba0f9a",
"name": "welderstats.csv",
"sep": ",",
"hdrin": "",
"hdrout": "none",
"multi": "one",
"ret": "\\n",
"temp": "",
"skip": "0",
"strings": true,
"include_empty_strings": "",
"include_null_values": "",
"x": 1380,
"y": 860,
"wires": [
[
"5151ca4c842e2cd9"
]
]
},
{
"id": "b625ab77800c3e39",
"type": "inject",
"z": "a1fe963ffcba0f9a",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 280,
"y": 860,
"wires": [
[
"abed8dae9bdbe212"
]
]
},
{
"id": "5151ca4c842e2cd9",
"type": "file",
"z": "a1fe963ffcba0f9a",
"name": "write to file",
"filename": "C:\\NODE\\node_red_ui\\public\\downloads\\test.csv",
"filenameType": "str",
"appendNewline": true,
"createDir": true,
"overwriteFile": "false",
"encoding": "utf8",
"x": 1560,
"y": 840,
"wires": [
[
"f08fbf9e55c3b426"
]
]
},
{
"id": "f08fbf9e55c3b426",
"type": "ui_button",
"z": "a1fe963ffcba0f9a",
"name": "",
"group": "c31affb830f65b0a",
"order": 1,
"width": 3,
"height": 1,
"passthru": true,
"label": "Download",
"tooltip": "",
"color": "",
"bgcolor": "",
"className": "",
"icon": "",
"payload": "{ \"payload\": { \"command\": \"addData\", \"arguments\": [ { \"facility\": \"daemon\", \"facilityCode\": 3, \"severity\": \"info\", \"severityCode\": 6, \"tag\": \"systemd[1]\", \"timestamp\": \"2020-01-02T19:17:39.793Z\", \"hostname\": \"localhost\", \"address\": \"127.0.0.1\", \"family\": \"IPv4\", \"port\": 38514, \"size\": 80, \"msg\": \"some demo data\", \"id\": 2351 }, true ], \"returnPromise\": true } }",
"payloadType": "json",
"topic": "payload",
"topicType": "msg",
"x": 1780,
"y": 840,
"wires": [
[]
]
},
{
"id": "8922194f09dd9a54",
"type": "ui_group",
"name": "Main",
"tab": "565c1bb57d8fd73a",
"order": 1,
"disp": false,
"width": "22",
"collapse": false,
"className": ""
},
{
"id": "c31affb830f65b0a",
"type": "ui_group",
"name": "Main Table",
"tab": "2141872d82d783c8",
"order": 1,
"disp": true,
"width": 22,
"collapse": true,
"className": ""
},
{
"id": "565c1bb57d8fd73a",
"type": "ui_tab",
"name": "Home",
"icon": "dashboard",
"order": 3,
"disabled": false,
"hidden": false
},
{
"id": "2141872d82d783c8",
"type": "ui_tab",
"name": "Data Collection",
"icon": "dashboard",
"order": 2,
"disabled": false,
"hidden": false
}
]