Forum Discussion

anandmar24's avatar
anandmar24
Occasional Contributor
10 years ago
Solved

To FindChild programmatically with Property Not Equal To specific Value

Hi All,



I have a parent object with 2 similar childern differentiated by WndCaption property. One has Blank and other has value. I need to find the child which has some value (that is not blank). How can we find this child object?



One way is, finding all the Children using FindAllChildren and then looping between them. Is there any other direct way to use the condition in FindChild?

  • This may work (haven't tried it): "*?*"

    Specifies any single character with any leading or trailing characters.

4 Replies

  • Ryan_Moran's avatar
    Ryan_Moran
    Valued Contributor
    This may work (haven't tried it): "*?*"

    Specifies any single character with any leading or trailing characters.
  • Ryan_Moran's avatar
    Ryan_Moran
    Valued Contributor
    Pass an array of properties and values to specify multiple properties and help narrow down your search. Should look something like this:

    myChildObject = ParentObject.FindChild(propertyArray,valueArray,depth,refresh)



    [url= http://support.smartbear.com/viewarticle/55112/]More information here.[/url]



    If this doesn't work in conjunction with wildcards (such as * and ?) then iterating the object array returned by the findall/findallchildren methods is probably the best alternative.
  • anandmar24's avatar
    anandmar24
    Occasional Contributor
    I dont have any other unique property than WndCaption to give in the FindChild method.



    Is there any way I can give something like this?



    WndCaption <> ""



    Wildcard character * (asterisk) represents from 0 character or 1?