Forms activities: pass option values

I need to pass option values to a Form so that the user can choose one of them (from a droplist). The values I get from a database and then store them in a dynamic variable (it doesn’t matter what type, i can adapt) so I can not put them directly into the form as ‘Values’, I need to treat them as if I don’t know what they are.

-I have tried passing an array with data binding but that didn’t work, the field just takes the whole array as the result.
-Also, I have tried with the ‘Custom’ option in Data with the following code:
‘for (var item in arrayministerio) {
values.push(item);
}’
but the Form can’t seem to access my array stored in Uipath.

So, how can i achieve this?

1 Like

Hi @m_p,

I tried to add array of string via values as data source and found that every time drop down list comes up with double values of whatever the array is :thinking:

S1

Output:

Hi, yes i noticed that too (it’s strange but it’s not the principal problem right now, but if you find a way to solve it, please tell me). I wnto to know: what output do you get when you choose one option? Is it what you chose or the entire array? (By output i mean the json string you put in properties)

This is what i get (see key “ministerio”)
output

Hi @m_p,

Entire array:
S2

:frowning: Ok, thanks anyway

@m_p

You can pass a List of String or Dictionary to populate the dropdown. You bind the collection to the dropdown control by using [ControlName]_dropdown. The [ControlName] of a dropdown is the Property Name within the Field Key tab. This would be referenced within the FormFieldsCollection property under Data Bindings within the Create Form activity.

Please take a look at the sample code which is built in 19.10.1.

CustomForm_DropdownInput_Example.zip (20.2 KB)

3 Likes

Thank you!! That worked, I had to change a lot of things but it was worth it in the end! :slight_smile:

Hi Joseph, thanks a lot, your sample works very well.