[
{
"id": "3650d7a4f00805cd",
"type": "tab",
"label": "Find Brucontrol Elements by Workspace",
"disabled": false,
"info": ""
},
{
"id": "1adf9c33a16a2580",
"type": "xml",
"z": "3650d7a4f00805cd",
"name": "xml --> js object",
"property": "payload",
"attr": "",
"chr": "",
"x": 320,
"y": 120,
"wires": [
[
"0d2dafbdd04e43d5",
"ec7022b3cb16c45e"
]
]
},
{
"id": "0d2dafbdd04e43d5",
"type": "function",
"z": "3650d7a4f00805cd",
"name": "js object to rows",
"func": "/*\npayload.Configuration.Workspaces[].Workspace[].Name[]\npayload.Configuration.Workspaces[].Workspace[].Elements[].Element[].Name[]\npayload.Configuration.Workspaces[].Workspace[].Elements[].Element[].ID[]\n\n04/25/23\n\npayload.Configuration.Workspaces[0].Workspace[0].Name[0]\npayload.Configuration.Workspaces[0].Workspace[0].Elements[0].Element[0].Name[0]\npayload.Configuration.Workspaces[0].Workspace[0].Elements[0].Element[0].ID[0]\n\npayload.Configuration.Workspaces\npayload.Configuration.Workspaces[0].Workspace\n*/\n\nmsg.originalData = msg.payload; //save in msg (for debugging)\n\nvar workspaces = msg.payload.Configuration.Workspaces[0].Workspace;\n//var workspaces = msg.payload.Configuration.Workspaces.Workspace;\n//var workspaces = msg.payload.Configuration.Workspaces;\n\n//workspace name get name\nvar wsName = 1;\nvar rows = [];\nfor (let iWS = 0; iWS < workspaces.length; iWS++) {\n let workspace = workspaces[iWS];\n let elements = workspace.Elements[0].Element;\n let workspaceName = workspace.Name[0];\n let workspaceRows = elements.map(el => {\n return {\n workspace: workspaceName,\n id: el.ID[0],\n name: el.Name[0],\n type: el.$[\"i:type\"],\n }\n })\n rows.push(...workspaceRows)\n}\nmsg.payload = rows;\nreturn msg;\n",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 320,
"y": 180,
"wires": [
[
"aa64322c2ebdc794"
]
]
},
{
"id": "aa64322c2ebdc794",
"type": "csv",
"z": "3650d7a4f00805cd",
"name": "",
"sep": ",",
"hdrin": "",
"hdrout": "all",
"multi": "mult",
"ret": "\\n",
"temp": "workspace,name,type,id",
"skip": "0",
"strings": true,
"include_empty_strings": "",
"include_null_values": "",
"x": 510,
"y": 180,
"wires": [
[
"fcd6d0634d779913"
]
]
},
{
"id": "8f33db8d99d2624f",
"type": "comment",
"z": "3650d7a4f00805cd",
"name": "____Use this path as a model for your path to 'UniFlex_3V_BinarySSR.brucfg'(XML) under Brucontrol folder ___",
"info": "",
"x": 380,
"y": 280,
"wires": []
},
{
"id": "5d19643d05b00b9e",
"type": "comment",
"z": "3650d7a4f00805cd",
"name": "Convert to JS object",
"info": "",
"x": 330,
"y": 80,
"wires": []
},
{
"id": "cca7dff47396985e",
"type": "comment",
"z": "3650d7a4f00805cd",
"name": "Convert JS object to rows",
"info": "",
"x": 330,
"y": 220,
"wires": []
},
{
"id": "772ad3494f072aea",
"type": "comment",
"z": "3650d7a4f00805cd",
"name": "Convert rows to CSV",
"info": "",
"x": 560,
"y": 220,
"wires": []
},
{
"id": "d33d57244befddd6",
"type": "inject",
"z": "3650d7a4f00805cd",
"name": "",
"props": [
{
"p": "payload"
},
{
"p": "topic",
"vt": "str"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "",
"payloadType": "date",
"x": 100,
"y": 80,
"wires": [
[
"3550faeb4f3ea6a8"
]
]
},
{
"id": "3550faeb4f3ea6a8",
"type": "file in",
"z": "3650d7a4f00805cd",
"name": "brucfg",
"filename": "C:/Users/sedgi/OneDrive/Documents/Brucontrol/UniFlex_3V_BinarySSR.brucfg",
"filenameType": "str",
"format": "utf8",
"chunk": false,
"sendError": false,
"encoding": "none",
"allProps": false,
"x": 90,
"y": 220,
"wires": [
[
"1adf9c33a16a2580"
]
]
},
{
"id": "fcd6d0634d779913",
"type": "file",
"z": "3650d7a4f00805cd",
"name": "UniFlex_3V_BinarySSR.brucfg-new.csv",
"filename": "C:/Users/sedgi/OneDrive/Documents/BeerSmith3/UniFlex_3V_BinarySSR.brucfg-new.csv",
"filenameType": "str",
"appendNewline": true,
"createDir": false,
"overwriteFile": "true",
"encoding": "none",
"x": 680,
"y": 340,
"wires": [
[]
]
},
{
"id": "d70cbb87bbf8033e",
"type": "comment",
"z": "3650d7a4f00805cd",
"name": "Define where you want the csv file to be written each time script runs--most close app viewing file before running again",
"info": " - ",
"x": 860,
"y": 380,
"wires": []
},
{
"id": "afa556db999f82e8",
"type": "comment",
"z": "3650d7a4f00805cd",
"name": "VERY IMPORTANT: Only use backup files or copy of current default.brucfg",
"info": "",
"x": 260,
"y": 40,
"wires": []
},
{
"id": "c42c37fd76a41461",
"type": "comment",
"z": "3650d7a4f00805cd",
"name": "(must close app viewing .csv before running again)",
"info": "",
"x": 650,
"y": 420,
"wires": []
},
{
"id": "ec7022b3cb16c45e",
"type": "debug",
"z": "3650d7a4f00805cd",
"name": "debug XML import",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 530,
"y": 80,
"wires": []
}
]