Using a variable inside a ui element

I am trying to select the last day of the previous month on a pop-up calendar. I have a variable for the last day of the previous month, but can not get it to work in my ui selector. I have looked at many examples and tried them all to no avail.

The selector properties (for example) are as follows:
SyntaxEditor Code Snippet

I want to replace the ‘31’ with the lastDayofPreviousMonth variable. Have tried the following:

<webctrl aaname=’ ‘“+lastDayofPreviousMonth+”’ ’ type=‘button’ innertext=’ ‘“+lastDayofPreviousMonth+”’ ’ />
<webctrl aaname=‘‘“+lastDayofPreviousMonth+”’’ type=‘button’ innertext=‘‘“+lastDayofPreviousMonth+”’’ />

and a few others. What am I doing wrong. The variable is in scope.
Thanks.

Hi @ravel70

Can you share the Screenshot of UI explorer and the lastDayofPreviousMonth Value

For Dynamic selector

Regards
Gokul

sorry, here is the original selector:
**not letting post the original for some reason, but where the variable is in the examples, there is a 31 with 13 spaces before and after.

image
original

daysInPreviousMonth
image

using above in selector with .toString

HI @ravel70

Try this selector?

Pass asterisk in place of empty space

<webctrl aaname=‘*{{lastDayofPreviousMonth}}*’ type=‘button’ innertext='*{{lastDayofPreviousMonth}}*’ />

Regards
Gokul

Hi @ravel70

  1. Create a variable like this lastDayofPreviousMonth and pass the date

image

  1. open UI Explorer in Click Activity and indicate on screen and check for “aaname” or “innertext” in the attributes

image

  1. Right click on the value and choose variable as you have created in the starting if not choose create variable and create a new one

4.As you remember this is the variable i have created so choosing this

  1. After Selecting it will become like his and works dynamically

Regards
Gokul

Thank you Gokul001.

just use the </> button from the editor or screenshots as you had done

as you got told combining it with * will help

About the selector design, focus on following strategy:

  • make the selector as short as possible
  • make the selector as specific as possible

using aaname and innertext is redundant. So go only for the innertext and dynamize it with variable and wildcards

will do. Thanks.

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