Name Property

Applies to TestComplete 15.42, last modified on September 08, 2022

Description

Use the Name property to obtain the name of the property collection, to which StoredObject provides access to.

Declaration

StoredObjectObj.Name

Read-Only Property String
StoredObjectObj An expression, variable or parameter that specifies a reference to a StoredObject object

Applies To

The property is applied to the following object:

Property Value

String holding the collection name.

Example

The following code demonstrates how you can access the desired property collection and its child collections.

JavaScript, JScript

function Test1()
{
  // Obtains the specified property collection and returns the total number of its child collections
  StoredObject = Objects.Items("MyCollection");
  Log.Message(StoredObject.ChildCount);

  // Obtains a child property collection by its index and returns the collection's name
  ChildCollection = StoredObject.Children(0);
  Log.Message(ChildCollection.Name);

  // Obtains the child property collection by its name
  // ChildCollection = StoredObject.ChildByName("ChildCollectionName");
}

Python

def Test1():
  # Obtains the specified property collection and returns the total number of its child collections 
  StoredObject = Objects.Items("MyCollection")
  Log.Message(StoredObject.ChildCount)
  # Obtains a child property collection by its index and returns the collection's name 
  ChildCollection = StoredObject.Children[0]
  Log.Message(ChildCollection.Name)
  # Obtains the child property collection by its name 
  # ChildCollection = StoredObject.ChildByName("ChildCollectionName")

VBScript

Sub Test1
  ' Obtains the specified property collection and returns the total number of its child collections
  Set StoredObject = Objects.Items("MyCollection")
  Log.Message(StoredObject.ChildCount)

  ' Obtains a child property collection by its index and returns the collection's name
  Set ChildCollection = StoredObject.Children(0)
  Log.Message(ChildCollection.Name)

  ' Obtains the child property collection by its name
  ' Set ChildCollection = StoredObject.ChildByName("ChildCollectionName")
End Sub

DelphiScript

procedure Test1;
begin
  // Obtains the specified property collection and returns the total number of its child collections
  StoredObject := Objects.Items('MyCollection');
  Log.Message(StoredObject.ChildCount);

  // Obtains a child property collection by its index and returns the collection's name
  ChildCollection := StoredObject.Children(0);
  Log.Message(ChildCollection.Name);

  // Obtains the child property collection by its name
  // ChildCollection := StoredObject.ChildByName('ChildCollectionName');
end;

C++Script, C#Script

function Test1()
{
  // Obtains the specified property collection and returns the total number of its child collections
  StoredObject = Objects["Items"]("MyCollection");
  Log["Message"](StoredObject["ChildCount"]);

  // Obtains a child property collection by its index and returns the collection's name
  ChildCollection = StoredObject["Children"](0);
  Log["Message"](ChildCollection["Name"]);

  // Obtains the child property collection by its name
  // ChildCollection = StoredObject["ChildByName"]("ChildCollectionName");
}

See Also

ChildByName Property
StoredObject Property

Highlight search results