UI Dropdown - Populating Data

how i can do this? Which node?
Can u give me a hint?

in your function where you create the options... just before the return add
msg.payload = "";

1 Like

Works like a sharm! Thanks!

I can't import this and it looks very interesting for me

Hi, I am trying to do something similar as shown here. Basically I want to do a query to extract names and IDs and introduce it to the dropdown list, using the ID as the output value and the name as the shown text to the user. I have used your flow to convert it to an array, but I dont manage to archive it.

Here is the flow that Im using:

[{"id":"244b484f.eb8748","type":"tab","label":"Flow 3","disabled":false,"info":""},{"id":"162a8e92.929ac1","type":"ui_dropdown","z":"244b484f.eb8748","name":"","label":"","tooltip":"","place":"Select option","group":"497a6f44.27083","order":3,"width":0,"height":0,"passthru":true,"multiple":false,"options":[{"label":"","value":0,"type":"num"}],"payload":"","topic":"","x":1100,"y":240,"wires":[[]]},{"id":"9accb523.207058","type":"function","z":"244b484f.eb8748","name":"","func":"msg.topic = \"SELECT ID_pac,Nombre FROM Pacientes\"\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":280,"y":200,"wires":[["11cea2ce.4b369d"]]},{"id":"edacaec2.a7f99","type":"inject","z":"244b484f.eb8748","name":"","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":true,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":120,"y":200,"wires":[["9accb523.207058"]]},{"id":"11cea2ce.4b369d","type":"mysql","z":"244b484f.eb8748","mydb":"2becde9d.a8a7b2","name":"","x":490,"y":220,"wires":[["5cb5f942.5260f8"]]},{"id":"5cb5f942.5260f8","type":"function","z":"244b484f.eb8748","name":"transform data to correct format","func":"//as per info panel, the data needs to be formatted\n//as [ \"Choice 1\", \"Choice 2\", {\"Choice 3\":\"3\"} ]\n//and sent in msg.options.\nmsg.options = [];//create empty array\nfor(let i = 0; i < msg.payload.length; i++){\n    let row = msg.payload[i]; //get the row\n    let opt = {};//make new opt object\n    opt[row[0]] = row[1]; //add a propery to object called row[0] & set its value to row[1]\n    msg.options.push(opt);//add the opt to array    \n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":750,"y":220,"wires":[["162a8e92.929ac1"]]},{"id":"497a6f44.27083","type":"ui_group","z":"","name":"MODIFICAR DATOS:","tab":"46554696.69f0b8","order":3,"disp":true,"width":"12","collapse":false},{"id":"2becde9d.a8a7b2","type":"MySQLdatabase","z":"","name":"","host":"127.0.0.1","port":"3306","db":"test","tz":""},{"id":"46554696.69f0b8","type":"ui_tab","z":"","name":"Home","icon":"dashboard","disabled":false,"hidden":false}]

I have a question how do I use payload in the opinion label

[
    {
        "msg.payload": "17260851BD"
    },
    {
msg.options=

[
    {
        "msg.payload": "17260851BD"
    },
    {
        "part_number_item2": "17299989AC"
    },
    {
        "part_number_item": "17246783FB"
    },
    {
        "part_number_item": "17299989AC"
    },
    {
        "part_number_item": "17246783FB"
    },
    {
        "part_number_item": "17299989AC"
    },
    {
        "part_number_item": "17246783FB"
    },
    {
        "part_number_item": "17299989AC"
    },
    {
        "part_number_item": "17246783FB"
    },
    {
        "part_number_item": "17299989AC"
    },
    {
        "part_number_item": "17246783FB"
    },
    {
        "part_number_item": "17299989AC"
    },
    {
        "part_number_item": "17246783FB"
    },
    {
        "part_number_item": "17299989AC"
    },
    {
        "part_number_item": "17246783FB"
    },
    {
        "part_number_item": "17299989AC"
    },
    {
        "part_number_item": "17246783FB"
    },
    {
        "part_number_item": "17299989AC"
    },
    {
        "part_number_item": "17246783FB"
    },
    {
        "part_number_item": "17299989AC"
    },
    {
        "part_number_item": "17246783FB"
    },
    {
        "part_number_item": "17299989AC"
    },
    {
        "part_number_item": "17246783FB"
    },
    {
        "part_number_item": "17299989AC"
    },
    {
        "part_number_item": "17246783FB"
    },
    {
        "part_number_item": "17299989AC"
    },
    {
        "part_number_item": "17246783FB"
    }
];


return msg;


Hi, everyone!
I must ask for help to do the following:

  1. Create a dropdown with "projectIDs" and select one from the list;
  2. Press a button to "start" the process with selected projectID;
  3. Press a button (or same button) to end the process;
  4. write that info into Influx db. "projectID"="StartTime"="EndTime"
    optional = populate the records with additional tags;
    optional = Combine multiple dropdowns with a context. Select 1st Dropdown with Categories, Then select 2nd Dropdown with corresponding items such as "projectIDs"

Hoping to find some clues or solutions!
Thank You!

Welcome to the forum @gliepins

I would start by starting at the beginning of your list, and moving on the next point once the previous one is basically functioning. So starting with item 1 I suggest starting with the dashboard dropdown node.

However, since this is an old thread I suggest starting a new thread, since this one is already solved. I will close this one.

Also if you are a beginner then I recommend watching this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.