How to replace a Value with a Variable.

Originally posted by lowres on July 10, 2025

Hello All. Hoping you can help…

I need to select an entry from a radComboBox.
Im using ClickItem. If I clickItem and use a number it will pick the relevant Item from the list.

It also works and it pick the item by name, Sausages from the list:

Aliases.Desktop.HwndSource_WindowHostWindow.WindowHostWindow.radComboBox.wText.Sausages

Ideally I want to pick the item by actual name stored as a variable (Project.Variables.CUBEROOTWORKFLOWPROFILE)
So something like this, but I am having trouble replacing Sausages with a predefined Variable.

Aliases.Desktop.HwndSource_WindowHostWindow.WindowHostWindow.radComboBox.wText.Project.Variables**.CUBEROOTWORKFLOWPROFILE**

What would the syntax be to replace hard coded Sausages with the Variable stored in Project.Variables.CUBEROOTWORKFLOWPROFILE?

This does not work:
Aliases.Desktop.HwndSource_WindowHostWindow.WindowHostWindow.radComboBox.wText.**Project.Variables.CUBEROOTWORKFLOWPROFILE?**Thanks for any pointer.

Originally posted by sean4311 on July 10, 2025

Hi lowres​ ,

So you can apply variables to keyword test operations in the “Value” Column.

  1. Double click on the cell that you want to apply the variable to.
  2. On the popup window, click on the ellipsis on the far right
  3. Change the “Mode” to Variable
  4. Specify the variable in the “Value” drop down and hit OK

Originally posted by lowres on July 10, 2025

Hi Sean,
So I end up with:

Project.Variables.CUBEROOTWORKFLOWPROFILE

But its unable to find that when I go to play it back.
It seems to need pointing to Aliases.Desktop.HwndSource_WindowHostWindow.WindowHostWindow.radComboBox.wText.

Error is

Total number of items: 5.
Items: ‘’, ‘’, ‘’, ‘’, ‘’.

Tested object:
Aliases.Desktop.HwndSource_WindowHostWindow.WindowHostWindow.radComboBox
(Sys.Process(“Desktop”).WPFObject(“HwndSource: WindowHostWindow”, “System.Windows.Controls.Grid”).WPFObject(“WindowHostWindow”, “System.Windows.Controls.Grid”, 1).WPFObject(“XFDialogContainer”, “”, 1).WPFObject(“MainContentControl”).WPFObject(“SelectWorkflowViewDlg”, “”, 1).WPFObject(“comboBoxCubeRoots”).WPFObject(“radComboBox”))

Originally posted by lowres on July 11, 2025

So the question I have is there a way to include a variable in the value?

Aliases.Desktop.HwndSource_WindowHostWindow.WindowHostWindow.radComboBox.wText.VARIABLEHERE

Originally posted by rraghvani on July 11, 2025

In your first screenshot, you have a name mapping called radComboBox, and you are calling the method ClickItem, to click on item ‘3’, in your combo box

Assuming you have already defined a persistent project variable called, Project.Variables.CUBEROOTWORKFLOWPROFILE = 3

Then you can reference the variable, in your keyword test step like so

which will then look something like this,

If you change the value of your variable, the keyword test action will click that item in your combo box

Originally posted by lowres on July 15, 2025

Thanks rraghavani,

Sorry, Im not being clear. Im just not clear on when I can use variables/how.

For example I want to enter a fruit name into notepad then press enter.

Types Apples and hits Enter

Now instead of typing Apples I want to type a Variable I have stored followed by Enter key press?

How do I concatenate an Enter key press onto the end of Variables.FRUITNAME variable?
Is the only way to add a additional Item line?

Originally posted by rraghvani on July 15, 2025

This is a slightly a different question from your original one, but the same principle applies, in using a variable.

Whatever value is stored in FRUITNAME variable, will be typed using the Keys operation, which is then followed by an carriage return. As shown in your screenshot,

If you are new to TestComplete, then watch some of the tutorials shown here TestComplete Video Center | SmartBear Software

Originally posted by lowres on July 16, 2025

So a variable and an Enter press can not happen in the same item?

I come from writing in LoadRunner and Robot Framework tools, I can just drop in predefined variables anywhere like in my scripts as needed.

Originally posted by rraghvani on July 16, 2025

If you have a variable called FRUITNAME having the following string value “Banana[Enter]Apple[Enter]Pear” and you use the Keys operation. It will enter each fruit name followed by a carriage return. You can find more information at Keys Action.

Scripts is different from Keyword Tests.

Originally posted by lowres on August 05, 2025

OK Thanks Rraghvani, so its not possible.
So you have to enter the [Enter] as part of the variable.
Thanks.

Originally posted by rraghvani on August 05, 2025

Hi Lowres,

I’m not familiar with LoadRunner or Robot Framework, and there may be a terminology difference between the tools.

With TestComplete, you declare a variable and assign it a value - Project.Variables.FRUITNAME = “Banana”. To select “Banana” from your list control, use the mapped alias name followed by the appropriate method to click the item - Aliases.MyApp.ListOfFruits.ClickItem(Project.Variables.FRUITNAME).

I strongly suggest you read through https://support.smartbear.com/testcomplete/docs/index.html and try out their tutorials. TestComplete is straight-forward to use, but you need to understand how the basics works first.