Using Wildcards With Variables In Activities

Is it possible to use wildcards with a variable? For example I have a drop down list on a website that has a few different options. I’m only intrested in 2 of the options. ASSET and DEBT. Most of the time Debt is presented as DEBT but other times it’s presented as (DEBT) with these parentheses. In order to choose an option I’ve used a Select Item activity with the String variable FORM as the input. This variable holds the word Debt or Asset based on an excel file. When Debt has the extra () characters, this activity fails as it can’t find DEBT

I wanted to know if it is possible to make this more flexibile. So if even if the dropdown has Debt listed as (Debt) and my variable is Debt, it could still correctly find and make the correct choice.

I tried using * or ? with the variable but that just gives errors.

I can forsee many other times that I will need the bot to choose the best match even when it isn’t exactly equal to the variable.

1 Like

use click activity and modify the selector with a variable. after you read the excel file you can use assign activity to give the specific value to the selector.

  • Substring the value that is there in the excel file and then store the options available in the select box in a variable,pass the variable to the Select Item Activity, with generic Selector.

  • Or use Type Into into your Select Box, it works for most cases.

Regards
Ranga.

Thanks for responding. My current set up is the same as your first bullet point. I have read the excel file and stored the value in the variable called FORM. This is passed to the Select Item activity. However this only works when the excel value is exactly the same as the drop down option.

I also tried the type into but it has the same error. For example: The value in excel will be Debt but the drop down is (Debt). I’ve only found this method to work when they both start with the same character.

What I’m trying to do is make it search or choose a value Like my excel value.

This would choose the closest match to my excel value even though its not the same as the drop down. So (Debt) or Debt? or Debtor would end up equaling Debt.

In Microsoft access sql for example, I would just write Debt between 2 * like * Debt * and it would choose any word or phrase that contains Debt

The closest match to the word ?

if the select item has countable values example < 10
you could try using a switch case with hard-coded values.
and use the switch as a container

Switch(yourExcelInput){
case "Debtor "
select your item
break
case Debt
select your item
break
case debits
select your item
Break
Default : Select Item Default;
break

}

What i mean is currently there is no variable wildcard. you have to use a work around.

Regards
Ranga.

1 Like

Thanks for letting me know! Sounds like I’ll just need to use the switch statement.

You could try reading the whole list - get full text then use Regex to try and match any item in the list with what you are looking for e.g. Debt in Debtor or visa versa, you could then assign your variable as other have suggested to the select item activity.

Hi,

Could you read the dropdown list in, and iterate through it and do an InString search for your variable name, and assign a count for each row down the list you are, before sending in that many {DOWN} key presses?

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.