Skip navigation
Currently Being Moderated

Can I use objXfa.ChildObjects( ) to filter?

Sep 2, 2010 8:49 AM

I have a subform that typically contains N+1 child objects: typically 1 header element and N rows.  I want to get the number of children, without making assumptions on the number of non-Row children (ie. I don't want the script to break just because a footer element was added).  All of the rows have the RO property "name" set to "sfRow" (while the header's name is set to "sfHeader").  So following the lead of other QTP testing domains, I wrote:

 

    Function GetNumRows( testobjSubform )
        Dim oMatchingDesc
        Set oMatchingDesc = Description.Create()
        oMatchingDesc("name").value = "sfRow"
        GetNumRows = testobjSubform.ChildObjects( oMatchingDesc ).Count

    End Function

 

This function consistently returns N+1, not the desired N, nor 0 (which would indicate my Description was filtering too much).

 

So, I assume AcroQTP's implementation of object.ChildObjects( [x] ) is different from all other (example help-doc below) implementations of object.ChildObjects( [x] ).  Is this correct?

 

Thanks,

Brent

 

Description

Returns  the collection of child objects contained within the object.

Important  Information

The method  returns the child objects that fit the description specified (using the Properties object).

Syntax

object.ChildObjects ([Description])

Syntax  Details

ArgumentDescription
objectAny Visual Basic test object.
DescriptionOptional. An Object object. The Properties (collection)  object containing the description of the objects you want to find. 
Tip: You can retrieve a  Properties collection using the GetTOProperties method or you can build a Properties collection object using the Description  object.  For more information on the Description object, refer to the  Utility section of the QuickTest Professional Object Model Reference.
 
Replies
  • Currently Being Moderated
    Feb 1, 2011 8:28 AM   in reply to Brent_2310242

    I am looking into this will have a reply soon.

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 1, 2011 9:00 AM   in reply to Brent_2310242

    Brian,

     

    After looking at this, I believe you would have better luck with

    GetNumRows -1.

     

    Tim

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 1, 2011 12:11 PM   in reply to Brent_2310242

    Brent,

     

    I am not ruling out the use of ChildObjects, but, so far I have had little luck with it, or finding anyone here that can help me with that.  I am looking to pull together an example of the GetNumRows approach.

     
    |
    Mark as:
  • Currently Being Moderated
    Mar 3, 2011 11:59 PM   in reply to TimHuff

    Thanks TimHuff you are doning good job. Keep sharing and helping. Keep it up .

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)

Answers + Points = Status

  • 10 points awarded for Correct Answers
  • 5 points awarded for Helpful Answers
  • 10,000+ points
  • 1,001-10,000 points
  • 501-1,000 points
  • 5-500 points