Populate input dropdown from json file


in my subflow I have set an input variable as a dropdown select. I would like to populate the dropdown from an external json file.
Is it possible?

You can't. These are environment variables and are evaluated/set in the runtime the moment you press deploy.

Could you explain what you are trying to do ?

Yes. I have to input a device ID into the variable, but my devices are more than 60 so each time I have to go through an excel sheet to find the ID. I was trying to write the list into a json file and present to th e dropdown list only the devices name.

Yes, set the object to msg.options and feed that into dropdown.

Use a file in node, read the JSON data in as a string, send it through a JSON node to convert it to a JS object, then pass it through a function node to do the filtering based on device ID & format the data as required (see the built in help of the ui_dropdown) and pass the list of options out in msg.options of the subflow. Connect subflow to your ui_dropdown.

NOTE: You cannot put UI Dropdown in the subflow.

Hi Steve, in the subflow there is a way to use a dropdown:

Schermata 2021-02-02 alle 10.07.43

I am not willing to use an UI dropdown, but the dropdown that is in the subflow input parameters.

Ah ok, no, they are statically created when you setup the subflow.

node-red editor is design time not runtime. (mostly)

I see... no workaround is possibile?

No not possible. Use a msg input instead.

What do you mean? msg.payload as input?

  • Sent from my mobile phone. Sorry for typos -

Hi @fmarzocca

It is not possible to dynamically generate the content in the subflow node's edit dialog - it must all be statically setup when you create the subflow template.

The only way to make that list of options dynamic would be to create a completely custom node from scratch where you can build all the custom logic in the edit dialog you would need to get the list.

There is no workaround with passing messages in if you requirement is to help the user pick from a list of devices when creating their flows.

I meant, send messages with a specific property that will be handled inside the subflow, eg;


1 Like

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