Hi, I hope someone could help me with this I have this code so is kind of database of equations, and when I save a new one it appears on the dropdown, so my problem is that it appears as number in the dropdown but I need the equation. This is my code.
[{"id":"f9a6103a.341d","type":"tab","label":"ecuacion basse de datos","disabled":false,"info":""},{"id":"aab5d463.2d90b8","type":"inject","z":"f9a6103a.341d","name":"Daily backup","repeat":"","crontab":"00 02 * * *","once":false,"onceDelay":"","topic":"","payload":"","payloadType":"date","x":160,"y":340,"wires":[["c52505d7.842528"]]},{"id":"c52505d7.842528","type":"function","z":"f9a6103a.341d","name":"Prep data","func":"// global variables separated by semicolon to be saved\nvar globallist = \"equa\"\nvar mylist = globallist.split(\";\");\n\nvar outputs = [];\n\nfor (i=0; i<mylist.length; i++) {\n outputs.push({ key : mylist[i], type: typeof global.get(mylist[i]), value: global.get(mylist[i])});\n}\n \n \nmsg.payload = outputs;\nreturn msg;\n\n","outputs":1,"noerr":0,"x":340,"y":340,"wires":[["46f289db.f51008"]]},{"id":"a9cc538d.0f9f3","type":"comment","z":"f9a6103a.341d","name":"Save global variables","info":"","x":160,"y":300,"wires":[]},{"id":"9c6f3be1.704888","type":"comment","z":"f9a6103a.341d","name":"Restore global variables","info":"","x":160,"y":380,"wires":[]},{"id":"b6c51d07.161a1","type":"inject","z":"f9a6103a.341d","name":"Startup","repeat":"","crontab":"","once":true,"topic":"","payload":"","payloadType":"date","x":140,"y":420,"wires":[["88f5dbb5.cfe298"]]},{"id":"e49c839c.88c38","type":"file","z":"f9a6103a.341d","name":"","filename":"/home/pi/global.json","appendNewline":true,"createDir":false,"overwriteFile":"false","x":800,"y":320,"wires":[["885c684d.01bb08"]]},{"id":"88f5dbb5.cfe298","type":"file in","z":"f9a6103a.341d","name":"","filename":"/home/pi/global.json","format":"utf8","x":340,"y":420,"wires":[["e8ebbd1b.17163"]]},{"id":"46f289db.f51008","type":"json","z":"f9a6103a.341d","name":"","property":"payload","action":"","pretty":false,"x":490,"y":340,"wires":[["e49c839c.88c38"]]},{"id":"e8ebbd1b.17163","type":"json","z":"f9a6103a.341d","name":"","property":"payload","action":"str","pretty":false,"x":510,"y":420,"wires":[["92ac1160.6639d"]]},{"id":"885c684d.01bb08","type":"debug","z":"f9a6103a.341d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1030,"y":320,"wires":[]},{"id":"1e7a28fe.7d2177","type":"ui_text_input","z":"f9a6103a.341d","name":"","label":"","tooltip":"","group":"3dc69e5a.3a0552","order":1,"width":0,"height":0,"passthru":true,"mode":"text","delay":300,"topic":"","x":160,"y":60,"wires":[["fe05ec6d.d42a2"]]},{"id":"4e84e1b1.f74f4","type":"ui_dropdown","z":"f9a6103a.341d","name":"","label":"","tooltip":"","place":"Select option","group":"bd526cf2.a7aee","order":0,"width":0,"height":0,"passthru":true,"options":[{"label":"","value":"","type":"str"}],"payload":"","topic":"","x":1080,"y":420,"wires":[["398c12d3.ac5bce","a4b08593.f4ca88"]]},{"id":"398c12d3.ac5bce","type":"ui_toast","z":"f9a6103a.341d","position":"top right","displayTime":"3","highlight":"","outputs":0,"ok":"OK","cancel":"","topic":"","name":"","x":1390,"y":480,"wires":[]},{"id":"366099ce.8fb416","type":"inject","z":"f9a6103a.341d","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"y = 2.1425x + 3.8416","payloadType":"str","x":180,"y":160,"wires":[["5a40815d.e1843"]]},{"id":"5b217509.41b30c","type":"inject","z":"f9a6103a.341d","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"y = 4.4607x + 8.3455","payloadType":"str","x":180,"y":200,"wires":[["5a40815d.e1843"]]},{"id":"66710816.fb33b8","type":"inject","z":"f9a6103a.341d","name":"","repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"y = 7.5648x + 13.75","payloadType":"str","x":170,"y":240,"wires":[["5a40815d.e1843"]]},{"id":"5a40815d.e1843","type":"function","z":"f9a6103a.341d","name":"","func":"if (!context.outputAlarms) {\n context.outputAlarms = [];\n}\ncontext.outputAlarms.push(msg.payload);\nmsg.payload = context.outputAlarms;\nreturn msg; ","outputs":1,"noerr":0,"x":430,"y":200,"wires":[["7d3559c2.a65af8"]]},{"id":"fe05ec6d.d42a2","type":"function","z":"f9a6103a.341d","name":"","func":"if (!context.outputAlarms) {\n context.outputAlarms = [];\n}\ncontext.outputAlarms.push(msg.payload);\nmsg.payload = context.outputAlarms;\nreturn msg; ","outputs":1,"noerr":0,"x":390,"y":60,"wires":[["6221338d.65f80c"]]},{"id":"6221338d.65f80c","type":"debug","z":"f9a6103a.341d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":560,"y":60,"wires":[]},{"id":"7d3559c2.a65af8","type":"function","z":"f9a6103a.341d","name":"","func":"var equa = msg.payload;\n\nglobal.set('equa',equa);\n\nreturn msg;","outputs":1,"noerr":0,"x":610,"y":200,"wires":[["58193c8e.c29964"]]},{"id":"58193c8e.c29964","type":"debug","z":"f9a6103a.341d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":770,"y":200,"wires":[]},{"id":"35653221.5d269e","type":"comment","z":"f9a6103a.341d","name":"equation data in","info":"","x":140,"y":120,"wires":[]},{"id":"a4b08593.f4ca88","type":"function","z":"f9a6103a.341d","name":"dropdown case","func":"let a = msg.payload;\nvar n = 2;\nvar m = 3;\nswitch (a){\n case \"y = 4.4607x + 8.3455 \" :\n msg.payload = n+m;\n\t\treturn msg;\n\t\n\tcase \"y = 2.1425x + 3.8416 \":\n\t msg.payload = m-n;\n\t\treturn msg;\n}","outputs":1,"noerr":0,"initialize":"","finalize":"","x":1380,"y":240,"wires":[["5aec4b97.187d74"]]},{"id":"5aec4b97.187d74","type":"debug","z":"f9a6103a.341d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","x":1570,"y":240,"wires":[]},{"id":"8d7c5286.0f60a","type":"change","z":"f9a6103a.341d","name":"","rules":[{"t":"set","p":"payload","pt":"msg","to":"[{\"equa\":\"\"}]","tot":"json"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":480,"wires":[["e6ffd047.e5d62"]]},{"id":"e6ffd047.e5d62","type":"debug","z":"f9a6103a.341d","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":930,"y":500,"wires":[]},{"id":"92ac1160.6639d","type":"function","z":"f9a6103a.341d","name":"","func":"var arr = global.get(\"equa\")||[];\nmsg.payload = arr;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":640,"y":420,"wires":[["8d7c5286.0f60a","e90fe93c.2533b8"]]},{"id":"e90fe93c.2533b8","type":"function","z":"f9a6103a.341d","name":"transform data to correct format","func":"msg.options = [];//create empty array\n let row = msg.payload; //get the row\n msg.options.push(row);//add the row to array \nreturn msg;\n","outputs":1,"noerr":0,"initialize":"","finalize":"","x":870,"y":420,"wires":[["4e84e1b1.f74f4"]]},{"id":"3dc69e5a.3a0552","type":"ui_group","z":"","name":"Default","tab":"415fe984.5556a8","order":1,"disp":true,"width":"6","collapse":false},{"id":"bd526cf2.a7aee","type":"ui_group","z":"","name":"Default","tab":"cd7f0463.187ef8","order":1,"disp":true,"width":"6","collapse":false},{"id":"415fe984.5556a8","type":"ui_tab","z":"","name":"dropdown","icon":"dashboard","order":1,"disabled":false,"hidden":false},{"id":"cd7f0463.187ef8","type":"ui_tab","z":"","name":"Menu","icon":"fa-tachometer","order":1,"disabled":false,"hidden":false}]
so in the pointed node I'm trying to chance the array to an object. Help please.