Dynamic Dropdown allows users to create dynamic items selection on a dropdown list like the image below

https://cdn.elev.io/file/uploads/PEfBOej3wR4slKcXFF0VfOndFuEYx_C9vFdA35csXyc/cLs5ArsTRJXnDDEejwdunMv1RlM-np7ksD_HVoazR5E/Screen Shot 2018-07-31 at 09.53.08-U0Q.png


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 bucket or removing.

https://cdn.elev.io/file/uploads/PEfBOej3wR4slKcXFF0VfOndFuEYx_C9vFdA35csXyc/VdvyCNBc3VQOHyG8-vTd7OwudUgj42mJ6nE5EPct-VE/Screen Shot 2018-07-24 at 16.23.54-dKo.png

First, you create a widget of type Input, enter the output variable and then select the type Dropdown in Parameter Configuration. 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/Bucket Example.

If you save now, the dropdown will have no option to be selected. Let's fill it.

Insert the following data in your bucket:

{
  variable: "supervisor_options",
  value: "John Doe"
} 

Now your dropdown should look like this:

https://cdn.elev.io/file/uploads/PEfBOej3wR4slKcXFF0VfOndFuEYx_C9vFdA35csXyc/z6qlosxYtLvawLGi3D0k-qG0lLWjZaBrFtxIRPGxtRc/Screen Shot 2018-07-24 at 16.25.54-uCw.png

Now there are scenarios where you need that option to be one, but the value stored in the bucket another. For example, if the supervisor has a code in your application instead of being stored by their names. In this case, you may want to use the metadata.value parameter.

{
  variable: "supervisor_options",
  value: "12433",
  metadata: {
    label: "John Doe"
  }
}