Value Property

Applies to TestComplete 15.47, last modified on January 20, 2023

The object-driven testing (ODT) functionality is deprecated. Do not use it to create new tests. It will be removed from the product in one of the future releases. As an alternative, you can create custom classes in your scripts. For more information, see Alternatives to the ODT functionality.

Description

Use the Variable.Value property to specify the value of the array item.

Declaration

VariableObj.Value

Read-Write Property Variant
VariableObj An expression, variable or parameter that specifies a reference to a Variable object

Applies To

The property is applied to the following object:

Property Value

The variable value. It can hold any OLEVariant-compatible value: string, integer, object reference, array, etc.

Remarks

The Value property is used by default in the Variable object, so you can omit it when addressing the item value. For instance, the following two lines are equivalent:

JavaScript

MyGroup.Variables(1).Value = 10;
MyGroup.$set("Variables", 1, 10);

JScript

MyGroup.Variables(1).Value = 10;
MyGroup.Variables(1) = 10;

VBScript

MyGroup.Variables(1).Value = 10
MyGroup.Variables(1) = 10

DelphiScript

MyGroup.Variables[1].Value := 10;
MyGroup.Variables[1] := 10;

C++Script, C#Script

MyGroup["Variables"](1)["Value"] = 10;
MyGroup["Variables"](1) = 10;

Example

The following code snippet obtains the variable in script and specifies its value:

JavaScript, JScript

function Test()
{

  var Group, MyVar;
  // Obtains the data group
  Group = ODT.Data.Groups("MyGroup");
  // Obtains the variable
  MyVar = Group.Variables("MyVar");
  // Sets the variable’s value
  MyVar.Value = "New Value";

}

VBScript

Sub Test

  Dim Group, MyVar
  ' Obtains the data group
  Set Group = ODT.Data.Groups("MyGroup")
  ' Obtains the variable
  Set MyVar = Group.Variables("MyVar")
  ' Sets the variable’s value
  MyVar.Value = "New Value"

End Sub

DelphiScript

procedure Test();
var Group, MyVar;
begin

  // Obtains the data group
  Group := ODT.Data.Groups('MyGroup');
  // Obtains the variable
  MyVar := Group.Variables('MyVar');
  // Sets the variable’s value
  MyVar.Value := 'New Value';

end;

C++Script, C#Script

function Test()
{

  var Group, MyVar;
  // Obtains the data group
  Group = ODT["Data"]["Groups"]("MyGroup");
  // Obtains the variable
  MyVar = Group["Variables"]("MyVar");
  // Sets the variable’s value
  MyVar["Value"] = "New Value";

}

See Also

Name Property
Items Property

Highlight search results