Dynamic Dropdown allows users to create dynamic items selection on a dropdown list like the image below
The items from a Dynamic Dropdown come from a variable, this means that you can change the values dynamically, developers can create any kind of input so users can insert the values to be selected in the Dynamic Dropdown.
You will want to use this feature when you constantly need to change the options available in a dynamic way. Imagine a scenario where you need to insert supervisors in your application and later attach these clients to a device. Using a Dynamic Dropdown you can easily change the client options by adding them to the device's data storage or removing them.
First, you create a widget of type Input Form, enter the output variable and then select the type Dropdown in Field Type. To define it as a Dynamic Dropdown, change the Use values from to Dynamic.
The previous options will disappear and now you need to define the variable where the options will come from. In this case, is client_options from the Device Example.
If you save now, the dropdown will have no option to be selected. Let's fill it.
Insert the following data in your device, you can use the Device Emulator:
{ variable: "supervisor_options", value: "John Doe" }
Now your dropdown should look like this:
Now there are scenarios where you need that option to be one, but the value stored in the device is another. For example, if the supervisor has a code in your application instead of being stored by their name. In this case, you may want to use the metadata value parameter.
{ variable: "supervisor_options", value: "12433", metadata: { label: "John Doe" } }