If Dropdown list not contain the value?

Hi everyone,
1.I have a excel sheet with details with Insurance company Names.
2.I want to enter that details into portal.that companyname lable is dropdownlist.
3.if that dropdown not contain what exactly coming from excel then i want to create new companyname.

Here my question is how to know that the dropdownlist is not containing that name?
there are lot of company names in dropdownlist…

can anyone help me

thanks in advance
krishnareddy

hi @krishnareddy

you can read the excel and get data into datatable, then in for each activity select the drop down element then click edit selector and then just copy the webcrtl line from the selector and remove all the selector then again click on edit selector and in aaname give the insurance company name.

just like that :-
image

Cheers :grinning:

Regards
Achal Sharma

1 Like

Hi @krishnareddy

you can use find children activity, that gives you an array of UiElements. From where you can get the count of all the companies name in the drop down.
Now use a “if” loop to iterate all the child’s in drop down and in the condition use get text activity which gives the name of the each drop down element(remember to make a generic selector of get text ).Now compare these names with the names in excel.You can pick the names by iterating the DT.
And if they match then enter the data and if they didn’t then throw an exception that “the company name is not available in the drop down”.
I hope it may help

Thank you

Hi @Achal_Sharma Thanks for ur response…
the dropdown list not like searchform it is select only if the data is not in that list we need to create that company name.

Hi @Sandeep_Tanwar Thanks for ur response
Children
This is How i use after children varible what condition i need give in IF ?

hi @krishnareddy

then use element exist and same selector which I mention earlier if the company exist then OK if not then add the company.

Cheers :grinning:

Regards
Achal Sharma

1)use get children activity, output will be Array of uielement.
2)use assign activity to get the count of the Array of uielements.
3)now use if loop, use condition- count>0
4)in then part, use get text element and give the selector of any drop down element.And pass the count variable in the selector and and replace the aaname with *.
5)This will give you the name in the drop drown fields one by one.
6)now in the same that is then block of if. use for each row activity and iterate the data table(excel).
7)use another if loop inside for each row with condition - row(0).ToString=output of get text.
8)now if the condition matches the follow the data entry other wise in else part use throw activity.

Thank You,
Hope It may help.