Replace part of the attribute in selector with variable

Hello, could you help me with this problem please? I’m trying to place a variable into an attribute, but cannot find a proper syntaxe. The attibute is like this
ctrl name=‘Row 5’ role=‘row’
and I need to replace the number with variable.

So far I got to this expression
ctrl name=‘Row " + AttachCounter.ToString + "’ role=‘row’
but I’m getting error “String constant must end with a double quote”.

Thank you in advance. Martin

Edit: Sorry, I didn’t notice missing expressions.

@martin.vlcek

“webctrl aaname='Test” + YourVariable + “'”

@martin.vlcek

check it

Hi @martin.vlcek

Try this:

"ctrl name='Row " + AttachCounter.ToString + "' role='row'"

Hope it helps!!
Regards

Unfortunately this doesn’t work.

Unfortunately this doesn’t work

Hi @martin.vlcek

Try this:

"ctrl name=""Row " + AttachCounter.ToString + """ role=""row"""

Can you share the screenshot so that we can help you with that.

Hope it helps!!
Regards

@martin.vlcek

Please put the screenshot so it will be easy to give best advice

Hi @martin.vlcek

Can you try the below syntax by replacing the last line:

<ctrl name='Row " & AttachCounter.ToString & "' row='row' />

Hope it helps!!

@martin.vlcek

Just delete the newline in every line and the error should go off…

Eg: <webctrl …./><webctrl…/>

Instead of each in one line

Also normally if you opening in selector editor then you can right click in the area you want to insert and select the variable…that also would work

Cheers

1 Like

This works! Thank you @Anil_G very much.

1 Like

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