Setting Dropdown in input text node

Hi all !!
I would like to know how to set up a drop down in text input where the dropdown contains values from sql database. actually I am sure how to retrieve values from database and show it in the ui. but not sure how to set up a dropdown and connect the dropdown to sql database. Seeking any support !

If you look at the help text for the dropdown node it tells you how to use msg.options to set the options.

Here is an example flow:

[{"id":"ebb59c2d73f361df","type":"inject","z":"5a7428fa9c18cd3d","name":"Sample data","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"[{\"id\":8,\"name\":\"Bates Thomas\"},{\"id\":2,\"name\":\"Catesby Robert\"},{\"id\":13,\"name\":\"Digby Everard\"},{\"id\":6,\"name\":\"Fawkes Guy\"},{\"id\":11,\"name\":\"Grant John\"},{\"id\":7,\"name\":\"Keyes Robert\"},{\"id\":5,\"name\":\"Percy Thomas\"},{\"id\":12,\"name\":\"Rookwood Ambrose\"},{\"id\":1,\"name\":\"Tresham Francis\"},{\"id\":4,\"name\":\"Wintour Thomas\"},{\"id\":9,\"name\":\"Wintour Robert\"},{\"id\":10,\"name\":\"Wright Christopher\"},{\"id\":3,\"name\":\"Wright John\"}]","payloadType":"json","x":150,"y":80,"wires":[["986031f1625cdd96","1d704a43291664a4"]]},{"id":"4585d7e591448a4e","type":"debug","z":"5a7428fa9c18cd3d","name":"Options","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"options","targetType":"msg","statusVal":"","statusType":"auto","x":540,"y":120,"wires":[]},{"id":"986031f1625cdd96","type":"change","z":"5a7428fa9c18cd3d","name":"","rules":[{"t":"set","p":"options","pt":"msg","to":"$$.payload.{ $.name:$string($.id)}[]","tot":"jsonata"}],"action":"","property":"","from":"","to":"","reg":false,"x":160,"y":120,"wires":[["4585d7e591448a4e","39d3920713922e4d"]]},{"id":"1d704a43291664a4","type":"debug","z":"5a7428fa9c18cd3d","name":"Input data","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":540,"y":80,"wires":[]},{"id":"39d3920713922e4d","type":"ui_dropdown","z":"5a7428fa9c18cd3d","name":"","label":"Staff member","tooltip":"","place":"Select option","group":"4f625e8062b00521","order":11,"width":"6","height":"1","passthru":true,"multiple":false,"options":[{"label":"","value":"","type":"str"}],"payload":"","topic":"topic","topicType":"msg","className":"","x":360,"y":160,"wires":[["723ca253da8cbc37"]]},{"id":"723ca253da8cbc37","type":"debug","z":"5a7428fa9c18cd3d","name":"Chosen staff ID (string)","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":590,"y":160,"wires":[]},{"id":"c01254a9f26c871c","type":"comment","z":"5a7428fa9c18cd3d","name":"select id, concat(surn, \" \", firstn) as name from staff order by surn;","info":"","x":290,"y":40,"wires":[]},{"id":"4f625e8062b00521","type":"ui_group","name":"Test","tab":"44cb81d560c73ae5","order":1,"disp":true,"width":"6","collapse":false,"className":""},{"id":"44cb81d560c73ae5","type":"ui_tab","name":"Test","icon":"dashboard","disabled":false,"hidden":false}]

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.