ElementFindChildrenValue and ElementGetChildFieldItem

Class library usage, coding and language questions.
jasong
Posts: 49
Joined: Fri Oct 26, 2007 9:38 pm
Location: Texas

ElementFindChildrenValue and ElementGetChildFieldItem

Post by jasong » Wed Jan 02, 2008 8:33 pm

According to the documentaion, ElementGetChildFieldItem takes the index of the element as an argument.

However, ElementGetChildrenValue returns not a list of indices but rather just the count of the number of elements matching that value.

Isn't then the example for ElementGetChildrenValue incorrect?

How can I find the index of an element with a particular value so that I can select it?

User avatar
Support Team
Site Admin
Site Admin
Posts: 12145
Joined: Fri Jul 07, 2006 4:30 pm
Location: Houston, Texas, USA
Contact:

Post by Support Team » Thu Jan 03, 2008 11:11 am

ElementGetChildrenValue searches the subtree of an element and internally saves the children that match the specified value. It then returns the number of saved children, i.e. the number of children matching the specified value.

The ElementGetChildFieldItem method is just a helper method to retrieve the elements internally saved by the ElementGetChildrenValue method. The index passed as an argument may range from zero to the number returned by the ElementGetChildrenValue method minus 1.

So, the documentation is correct and the example should work as well (I just checked that) :)

Alex
Ranorex Support Team

jasong
Posts: 49
Joined: Fri Oct 26, 2007 9:38 pm
Location: Texas

works like a charm

Post by jasong » Thu Jan 31, 2008 8:41 pm

Thanks for the clue! Now I have things working very smoothly.