PropertyCount Property

Applies to TestComplete 14.10, last modified on June 5, 2019

Description

Use PropertyCount to obtain the total number of properties stored in the collection, to which StoredObject provides access to. This number does not include properties of child collections.

Declaration

StoredObjectObj.PropertyCount

Read-Only Property Integer
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

An integer value specifying the number of stored property values.

Example

The following code demonstrates how you can access the desired item of the Objects collection and the properties stored in this item.

JavaScript, JScript

function Test1()
{
  // Obtains the specified property collection
  StoredObject = Objects.Items("MyCollection");
  Log.Message("The total number of property values stored by the collection: " + StoredObject.PropertyCount);

  // Access the specified stored property
  StoredObjectProperty = StoredObject.Properties(0);
    // --or--
  // StoredObjectProperty = StoredObject.PropertyByName("Caption");
  PropertyName = StoredObjectProperty.Name;
  PropertyValue = StoredObjectProperty.Value;
  Log.Message(PropertyName + " = " + PropertyValue);
}

Python

def Test1():
  # Obtains the specified property collection 
  StoredObject = Objects.Items("MyCollection")
  Log.Message("The total number of property values stored by the collection: " + str(StoredObject.PropertyCount))
  # Access the specified stored property  
  StoredObjectProperty = StoredObject.Properties[0]
  # --or-- 
  # StoredObjectProperty = StoredObject.PropertyByName["Caption"]
  PropertyName = StoredObjectProperty.Name 
  PropertyValue = StoredObjectProperty.Value
  Log.Message(PropertyName + " = " + str(PropertyValue))

VBScript

Sub Test1
  ' Obtains the specified property collection
  Set StoredObject = Objects.Items("MyCollection")
  Log.Message("The total number of property values stored by the collection: " & StoredObject.PropertyCount)

  ' Access the specified stored property
  Set StoredObjectProperty = StoredObject.Properties(0)
    ' --or--
  ' Set StoredObjectProperty = StoredObject.PropertyByName("Caption")
  PropertyName = StoredObjectProperty.Name
  PropertyValue = StoredObjectProperty.Value
  Log.Message(PropertyName & " = " & PropertyValue)
End Sub

DelphiScript

procedure Test1;
begin
  // Obtains the specified property collection
  StoredObject := Objects.Items('MyCollection');
  Log.Message('The total number of property values stored by the collection: ' + StoredObject.PropertyCount);

  // Access the specified stored property
  StoredObjectProperty := StoredObject.Properties(0);
    // --or--
  // StoredObjectProperty := StoredObject.PropertyByName('Caption');
  PropertyName := StoredObjectProperty.Name;
  PropertyValue := StoredObjectProperty.Value;
  Log.Message(PropertyName + ' = ' + PropertyValue);
end;

C++Script, C#Script

function Test1()
{
  // Obtains the specified property collection
  StoredObject = Objects["Items"]("MyCollection");
  Log["Message"]("The total number of property values stored by the collection: " + StoredObject["PropertyCount"]);

  // Access the specified stored property
  StoredObjectProperty = StoredObject["Properties"](0);
    // --or--
  // StoredObjectProperty = StoredObject["PropertyByName"]("Caption");
  PropertyName = StoredObjectProperty["Name"];
  PropertyValue = StoredObjectProperty["Value"];
  Log["Message"](PropertyName + " = " + PropertyValue);
}

See Also

Properties Property

Highlight search results