How to pass variables in selectors

Hello ,

Could you please guide me on how to pass variables in selectors

12 Likes

Hello!

You have to pass the entire selector through a variable (String) and modify what you need on that variable.

To be clear, I’m attaching a Example of how do that.

Any doubts, please let me know.

Regards,

SelectorVariable_Example.xaml (7.3 KB)

PS - On the example I’m typing “Hello World” in a Notepad.

19 Likes

Thank you…It worked

2 Likes

Hi Lucas,

when i try to replicate the same scenario, i am facing a selector issue.

this is the selector i founded in my work flow,

the selector in the work flow you shared is

why the difference, how could you achieve this selector .

Please, let me know .

Thanks in advance.

1 Like

Hello!

I just passed the selector value as a String on selectorContent variable.

:slight_smile:

2 Likes

Do you have any idea, why selector is different ?

I am also facing the same problem. I am trying to use a counter and assign it to Selector
Actual element Selector:
image

Trying to dynamically assign ‘tableRow’, as;
image

But this does not work :frowning:
It does not find the element…
How do I fix it?

Hey @BuddingCoder

Use i.Tostring() .

Regards…!!
Aksh

1 Like

Thanks, but it does not find the element.

I have added a check to see if such an element exist and it fails everytime (while using ‘i’).
The same thing if I try to replace with exact number, the script runs successfully and the check return true.

check the selecters try to debug or use UIexplorer.

Ok, will try that…

in the above given seletor Can someone help us how to increment the table row using the variable.

Even I am facing the same issue, though I enter the variable name in quotes as ’ “+day” ’ it gets converted to webctrl aaname=‘& quot;+day& quot;’ after I run my workflow.

How to escape double quotes(") in the selector? Or am I missing something else?

Please help

Hi @Shiny,
use like this
<webctrl aaname='"+day.ToString()+"' />

Regards,
Arivu

1 Like

I have followed SelectorVariable_Example.xaml however I encounter error below.

Can someone please advice on this?

Thanks.

1 Like

Hi, Lucas.

I apply the same logic of your example to my case and I get this error

My selector is this

“<webctrl tableCol=‘8’ tableRow=” & pRowCounter.ToString & “tag=‘INPUT’ />”

If someone can help, please.

Thanks

Hi @aedsferrao,

use this one
"<webctrl tableCol='8' tableRow='"+pRowCounter.ToString+"' tag='INPUT' />"

Regards,
Arivu

1 Like

@arivu96

Thanks I forgot to put apostrophes in tableRow.

Works fine now :smiley:

Hi,
<webctrl aaname=‘"+day.ToString()+"’ parentid=‘drawerMiniMonthNavigator’ tag=’
I already used ’ “+day.ToString” ’ but it just didn’t work out. I use google calender so i don’t know this fail just appear on gg calender or not.

Thanks

1 Like

hi this video help you to understand dynamic selectors