Hi all, I am currently attempting to populate my dropdown UI dynamically based on the results from my queries from my InfluxDB. Then selecting the options, I set the options to my flow context where I wish to work with further.
Populating my Dropdown UI was successful and selecting them when there are multiple options worked. However, the problem arise when there is only a single option available to me. Selecting the single option doesn't seem to show up. This can be confirmed when I select and my flow variable doesn't show up.
[{"id":"7d06c5e1.55ce1c","type":"function","z":"c8ba669.7292398","name":"Get TagValues values","func":"var arr = [];\nvar i;\n\nfor(i=0; i< msg.payload.length; i++){\n arr[i] = msg.payload[i]._value;\n}\n\nmsg.payload = arr;\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":360,"y":1760,"wires":[["3f81a46a.9a233c"]]},{"id":"3f81a46a.9a233c","type":"change","z":"c8ba669.7292398","name":"Set ID values to Options","rules":[{"t":"set","p":"options","pt":"msg","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":610,"y":1760,"wires":[["cfc73d1a.b1347"]]},{"id":"cfc73d1a.b1347","type":"ui_dropdown","z":"c8ba669.7292398","name":"","label":"TagValues","tooltip":"Show available TagValues from selected Measurement & TagKeys","place":"Select option","group":"382edf47.d12b3","order":9,"width":6,"height":3,"passthru":true,"multiple":false,"options":[{"label":"","value":"","type":"str"}],"payload":"","topic":"","topicType":"str","x":830,"y":1760,"wires":[["3fbf31a0.b3e2be","a64b20c1.97316"]]},{"id":"3fbf31a0.b3e2be","type":"change","z":"c8ba669.7292398","name":"","rules":[{"t":"set","p":"tagvalues","pt":"flow","to":"payload","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":1030,"y":1760,"wires":[[]]},{"id":"382edf47.d12b3","type":"ui_group","name":"InfluxDB Query & Delete","tab":"7bbd3bc8.7e32d4","order":2,"disp":true,"width":22,"collapse":false},{"id":"7bbd3bc8.7e32d4","type":"ui_tab","name":"Home","icon":"dashboard","order":2,"disabled":false,"hidden":false}]
What you see is a node that accepts my query results in array form and add them one by one into my payload before converting them to msg.options for the dropdown node. Output of dropdown node will then be selected to be set into flow context.
Thanks