Matching a variable from a data table to a select drop down list

I did a lot of digging and tried to word this a few different ways but could not find the exact answer on the forums. So here we go!

I have a spread sheet that I turned into a data table (read range ) I matched all the variables to the columns for the data I needed to grab. My current headache is matching the ethnicity on the data table to the drop down list on the web portal I am using. All of this is nested in a for each row function that fills the data from the entire sheet.

A generic example would be :
Ethnicity variable on spread sheet line 1 = Caucasian / using Select Item select Caucasian
Ethnicity Variable on spread sheet line 2 = African American /use select item to select African American
rinse and repeat.
I tried keying if statements but there are multiple data types in the drop down and the ethnicity variable will most likely have different data types month to month so that was a no go.

Ok, if I have understood correctly, you are iterating through a datatable which has, among other things, a column called ‘Ethnicity’ and you need to set a drop drop menu option in a web app to the ethnicity value each time you iterate through a row?

Two ways, the most efficient would work if the ethnicity value in the table always exactly matched the value it needs to select from the drop down menu. If this is the case then in the select activity you are using to select the drop down value, instead of hard coding the value you wish to select, use - row(“Ethnicity”).ToSting - this will mean you will select the value from the dropdown which exactly matches the value in the Ethnicity column.

If the table value and dropdown values do not match however, it will be a bit more complicated, and you should use a switch activity with a string condition of row(“Ethnicity”).ToString and then map out each different value it could be, and for each case have an assign, assigning a string variable with the corresponding value from the dropdown. Then when you select the value in the dropdown menu, instead of hard coding a value, use the string variable you just assigned a value to. It’s a little harder to explain and a lot longer to code so hopefully you can just use option 1 :wink:

Thanks for the response.

I think option one will work since the values in the data table match the values in the drop down. I have the ethnicity value set to string in a previous step so that part is good to go. My current issue is how do I tell the select command I want it to select whatever value is in the Ethnicity string value ?

image