Based on values in excel, UI path should press a certain key in the Drop down to select that value

Hello,

I have an excel in which i have a column “Gender” in which i have values such as Male, Female, Unspecified etc.
Based on the value provided in Excel column “Gender”, RPA must open the “Gender” drop down in my web application and press “F” if excel value is Female and “M” if excel value in Male and likewise.
How do i get this done Dynamically?

Hi @Jigar,

Great…!

There are two approaches we can handle this situation with.

  1. We have a activity named select item activity, that can select the item that we want from the drop down list.

  2. Else if you are not ale to use select item activity for that element, kindly consider the following sequence,

–get the value from the excel and assign it to a variable (Gender)
–use an if condition like if Gender.tostring.equals(“Male”) under then container, use click activity to click the menu and again click activity to click “M” or in else container, do the same to click “F”

Hope this would help you,

Cheers…!

Hi @Palaniyappan,

Thanks for your quick response.

For approach 2, i have 5 values in the gender drop down. How do i get each of them selected based on my value in Excel using IF
What i tried is “type into” and then followed by SendHotKey.
how do i store all 5 and then call each one based on the value in excel?

Can you help?

@Jigar,

That’s amazing, I thought like you can only select from drop down list rather like mentioning in a field.
if you can enter the value to a FIELD then you can use type into and hotkey as you mention.

Bravo…!

I Cant type into the field. However, i can click on the drop down and then i user “Send hotkey” as “F” to select female.
having said that, its static. I would like it to be more dynamic where if my excel column says “Male”, then it should select “male” from the drop-down, and if it says “Female”, then select female, if it says Unspecified, then select option Unspecified and so on.
Attached is the image of the drop down.

image

@Palaniyappan
Any updates to dynamically click on the value which i have specified in excel.

I m checking buddy, 5 mins pls

Hi @Jigar,

Buddy…! you can click dynamically on a drop down list by using Click image activity next to a click activty (for clicking the down arrow), have if condition or switchcase condition to click on the text (image captured with click image) to access it dynamically.

Hope this would help you…Kindly revert for any suggestions

Cheers

@Jigar

Is that working buddy…!

@Palaniyappan,

  1. I have used Click activity to click on drop down
  2. After that, i have used “If” Condition where
    IF row(3).ToString = “Female” then “Type Into” as “f” and Send hotkey “enter” ELSE
    if row(3).ToString = “Male”, then “Type Into” as “m” and Send hotkey “enter”

However, as i mentioned earlier, there are 5 values in a drop down and if i keep doing if else, it becomes too big. I want to know if i can dynamically provide all values in one and based on the value in Excel, it can click on female or male or unknown or unspecified etc.

Note: I have several other drop downs with many many options across the whole application. So if we can figure out a certain way to do it easily, then i can apply the same logic across all other drop downs.

Great…! Lets take it this way…whether you have a column with 5 rows having only distinct gender values or 50 rows each row with different gender…i hope you are going to get those values of the specific cell using for each row or for each loop…using assign activity like GenderValue = row(gendercolumnname).tostring, inside a loop…
Here comes what to do next…
Once you get the variable…use sub string to get the first character of the gender value and assign it to a variable…

Now use click activity with the value of substring variable and send hotkey

This would enter dynamically based on the the value in the Excel…
Hope this would help u
Cheers

@Palaniyappan
Thanks for the response.

However, i am still new to this and i am not sure how to use substring to get the first characters of the gender value and then assign it to variable.

Can you provide an xaml sample of the same for easier understanding.

No worries buddy…i will give you the xaml file…meanwhile lets do this,

Assign activity
Substring_var = GenderValue.substring(0,1)

Here the 0 represents the starting index and 1 represents the no of characters to be extracted from the starting index, thus gives us the first character

Then…in type into activity, give substringvariable as input with hotkey assigned like, inside type into
Substringvaraiable+“[k(enter)]”…this s similar like how you did previously buddy

Let do this buddy…mean while i will provide you the xaml…would be very happy if you could do it…

Cheers…

it is possible using click activity if select item activity not supports,using click activity indicate on of the drop down value like Male you ll get a selector ,their you ll get a aaname=‘Male’ if not get like use ui explorer and get the full selector with aaname and their you pass aaname=‘“+yourvariable+”’

if it not works use type into activity to type the value in drop down if it supports for type into

1 Like

But problem with this is only you can select visible values from the dropdown list. If suppose dropdown has more values and you want to select downside values from the dropdown then selector won’t identify the elements.


dynamic selector for above drop down "<webctrl aaname='"+item.ToString+"' parentid='searchForm' tag='A' />"

here item=any month u can pass it will select that month

Hi @shyamm,

Yes, i tried with 2 activities below

  1. Click Activity (to click on Drop down)
  2. Type Into Activity (row.Item(“Gender”).ToString +“[k(enter)]”)
    For activity 2, in my excel i have given only first 3 starting characters of the option that i want to select. So the bot is pressing those 3 characters and arriving at the option that i have given in excel.

However, this is not the solution that i am looking for.

Issue here i think is that the drop downs that i have are “Angular” drop down or P-Dropdown. That may be the reason why i am not able to use “Select Item” activity