Use variable in selector

selector
variable

#1

Hi I wonder how you guys can use variable in selector.
I been searching how to do it but I still can’t able to do it. Please help.

For example I have variable is needed to type in search.
It will give me 2-3 options to choose. However I want to choose excactly options got the same name as variable.

Follow is 3 options that I can extracted from screen by UI explorer.

<html app='chrome.exe' title='Client Cases - Sys' />
<webctrl parentid='ui-id-7' tag='STRONG' aaname='Diploma of Hospitality Management' />

<html app='chrome.exe' title='Client Cases* - Sys'/>
<webctrl tag='STRONG' aaname='Diploma of Hospitlity' />

<html app='chrome.exe' title='Client Cases - Sys' />
<webctrl tag='STRONG' aaname='Advanced Diploma of Hospitality Management' />

Either by record or by choose click in activities. I can make Uipath to select 3 options about.
Because I want to use variable name Course to put into selection.

I change the code

<html app='chrome.exe' title='Client Cases* - Sys' />
<webctrl tag='STRONG' aaname=' "+Course+" ' />

to put into selection but it seem give me some errors or doesn’t work some how.

  1. The code <webctrl tag='STRONG' aaname=' "+Course+" ' />
    change to <webctrl tag='STRONG' aaname=' qoute&Course&qoute ' />

2.If I insert Click in activities into the sequense. then paste the code into selector.
it give me error: Complier errors encountered processing expression.

Thank you very much. I appreciate your reply.

Hung


#2

Hi @hungdo,

1.Open the selector from the activity.
2.delete the selector and click ok
3.now again open and paste your selector with double quotes.

Regards,
Arivu


#3

Hi arivu

  1. I tried insert click activity
    then choose selector
    and then paste the code.

<html app='chrome.exe' title='Client Cases* - Sys' />
<webctrl tag='STRONG' aaname=' "+Course+" ' />

it shows me complier error.
then I deleted it and paste it again. the errors still there.

  1. I choose click activity and then choose select on screenshot.
    and I can’t delete the selector.

Please advice, Many thanks
Hung


#4

Hi @hungdo,

use this one
<html app='chrome.exe' title='Client Cases* - Sys' /> <webctrl tag='STRONG' aaname='"+Course.ToString()+"' />

Regards
Arivu


#5

Hi arivu
I still got the same errors
as you can see in the pic

Regards
Hung


#6

Hi @hungdo,

I told to use double quotes from starting and ending to make it as string.

So from starting put double quotes" and make it as single line and end use one more double quotes".

"<html app='chrome.exe' title='Client Cases* - Sys' /> <webctrl tag='STRONG' aaname='"+Course.ToString()+"' />"

Regards,
Arivu


#7

Hi
It works.
Many thanks
Hung


#8

Hi Arivu
I wonder if I can use wildcard in this code?
as I wanted to put aaname='"+Course.ToString()*+"' />
but I don’t know how to change the about code.

Thanks
Hung


#9

Hi @hungdo,

Try like this

aaname='"+Course.ToString()+"*' />

Regards,
Arivu


#10

Hi Arivu
The second one is good.
Thank you so much
Hung