I Have a sample database where I want to extract the values from the first column Called zone
my flow looks like this:
the code looks like this:
[{"id":"5988b4fb.4e292c","type":"ui_dropdown","z":"33b0e6d0.3a306a","name":"","label":"","tooltip":"","place":"Select option","group":"8cab92c0.9fd48","order":1,"width":7,"height":1,"passthru":true,"multiple":false,"options":[{"label":"","value":"zone1","type":"str"},{"label":"","value":"zone2","type":"str"},{"label":"","value":"zone3","type":"str"},{"label":"","value":"zone4","type":"str"},{"label":"","value":"zone5","type":"str"},{"label":"","value":"zone6","type":"str"},{"label":"","value":"zone7","type":"str"},{"label":"","value":"zone8","type":"str"},{"label":"","value":"zone9","type":"str"},{"label":"","value":"zone10","type":"str"}],"payload":"","topic":"","topicType":"str","className":"","x":870,"y":1290,"wires":[[]]},{"id":"4d698fee.f1d92","type":"inject","z":"33b0e6d0.3a306a","name":"","props":[{"p":"options","v":"","vt":"str"},{"p":"topic","vt":"str"}],"repeat":"10","crontab":"","once":true,"onceDelay":"1","topic":"","x":95,"y":1290,"wires":[["6da524f3.1a85dc"]]},{"id":"6da524f3.1a85dc","type":"function","z":"33b0e6d0.3a306a","name":"Get all zones","func":"msg.topic=\"SELECT zone FROM roomsettings\";\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":265,"y":1290,"wires":[["80d23340.bc3e1"]]},{"id":"80d23340.bc3e1","type":"mysql","z":"33b0e6d0.3a306a","mydb":"19cd94c9.124aeb","name":"hpsim","x":410,"y":1290,"wires":[["b9fe30a9.58a4d","a0f670dc.ce3f5"]]},{"id":"b9fe30a9.58a4d","type":"function","z":"33b0e6d0.3a306a","name":"Write to dropdown menu","func":"\n\nmsg.options=[\"test\",\"test2\"]\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":635,"y":1290,"wires":[["5988b4fb.4e292c"]]},{"id":"a0f670dc.ce3f5","type":"debug","z":"33b0e6d0.3a306a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":680,"y":1380,"wires":[]},{"id":"8cab92c0.9fd48","type":"ui_group","z":"","name":"Group 2","tab":"f8e03f23.edb1b","order":1,"disp":true,"width":"7","collapse":false},{"id":"19cd94c9.124aeb","type":"MySQLdatabase","z":"","name":"sql database","host":"mariadb","port":"3306","db":"hpsim","tz":"","charset":"UTF8"},{"id":"f8e03f23.edb1b","type":"ui_tab","z":"","name":"Plant","icon":"dashboard","disabled":false,"hidden":false}]
the problem is the output from the database query:
so my problem is how can I extract and merge the text so i would look like this:
msg.options=["zone1","zone2"......]
return msg;
Its the formate the dropdown list accepts..
Best regards
Henrik